mirror of
https://github.com/XRPLF/xrpl-dev-portal.git
synced 2025-11-20 11:45:50 +00:00
Part 2 of the fix for Issue 1820 (Move AMM pages) (#1867)
* Remove in-development files for AMM proposal * Add redirects for in-development AMM pages
This commit is contained in:
committed by
GitHub
parent
6e0a24f0c7
commit
4c01a5dbf7
@@ -1,261 +0,0 @@
|
||||
---
|
||||
html: amm_info.html
|
||||
parent: path-and-order-book-methods.html
|
||||
blurb: Get info about an Automted Market Maker (AMM) instance.
|
||||
status: not_enabled
|
||||
labels:
|
||||
- 分散型取引所
|
||||
- クロスカレンシー
|
||||
- AMM
|
||||
---
|
||||
# amm_info
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/rpc/handlers/AMMInfo.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
`{{currentpage.name}}` メソッドは、自動マーケットメーカー(AMM)インスタンスに関する情報を取得します。
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
|
||||
### リクエストのフォーマット
|
||||
|
||||
リクエストの例
|
||||
|
||||
{% include '_snippets/no-cli-syntax.ja.md' %}
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "{{currentpage.name}}",
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "{{currentpage.name}}",
|
||||
"params": [{
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[試してみる>](websocket-api-tool.html?server=wss%3A%2F%2Famm.devnet.rippletest.net%3A51233%2F#amm_info)
|
||||
|
||||
リクエストには以下のパラメーターが含まれます。
|
||||
|
||||
| `フィールド` | 型 | 説明 |
|
||||
|:-----------|:-----------------------|:-----------------------------------|
|
||||
| `asset` | オブジェクト または 文字列 | [通貨額][Currency Amount]のように、`currency`と`issuer`フィールドを持つオブジェクトとして(XRPの場合は`issuer`を省略)、検索するAMMの資産の一つを指定します。XRPの場合は、オブジェクトではなく文字列`XRP`として指定することができます。 |
|
||||
| `asset2` | オブジェクト または 文字列 | AMMの資産のもう一方を、`currency`と`issuer`フィールド(XRPの場合は`issuer`を省略)を持つオブジェクトとして、[通貨額][Currency Amount]のように指定することが可能です。 |
|
||||
|
||||
|
||||
### レスポンスのフォーマット
|
||||
|
||||
|
||||
処理が成功したレスポンスの例:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"amm": {
|
||||
"amm_account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"amount": "296890496",
|
||||
"amount2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value": "25.81656470648473"
|
||||
},
|
||||
"asset2_frozen": false,
|
||||
"auction_slot": {
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"auth_accounts": [
|
||||
{
|
||||
"account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
|
||||
},
|
||||
{
|
||||
"account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
|
||||
}
|
||||
],
|
||||
"discounted_fee": 0,
|
||||
"expiration": "2023-Jan-26 00:28:40.000000000 UTC",
|
||||
"price": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "0"
|
||||
},
|
||||
"time_interval": 0
|
||||
},
|
||||
"lp_token": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "87533.41976112682"
|
||||
},
|
||||
"trading_fee": 600,
|
||||
"vote_slots": [
|
||||
{
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"trading_fee": 600,
|
||||
"vote_weight": 9684
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_current_index": 316725,
|
||||
"validated": false
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"amm": {
|
||||
"amm_account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"amount": "296890496",
|
||||
"amount2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value": "25.81656470648473"
|
||||
},
|
||||
"asset2_frozen": false,
|
||||
"auction_slot": {
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"auth_accounts": [
|
||||
{
|
||||
"account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
|
||||
},
|
||||
{
|
||||
"account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
|
||||
}
|
||||
],
|
||||
"discounted_fee": 0,
|
||||
"expiration": "2023-Jan-26 00:28:40.000000000 UTC",
|
||||
"price": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "0"
|
||||
},
|
||||
"time_interval": 0
|
||||
},
|
||||
"lp_token": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "87533.41976112682"
|
||||
},
|
||||
"trading_fee": 600,
|
||||
"vote_slots": [
|
||||
{
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"trading_fee": 600,
|
||||
"vote_weight": 9684
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_current_index": 316745,
|
||||
"status": "success",
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
レスポンスは[標準フォーマット][]に従っており、成功した場合は以下のフィールドを含みます。
|
||||
|
||||
| フィールド | 型 | 説明 |
|
||||
|:-----------------------|:---------------------|:----------------------------------------------------------|
|
||||
| `amm` | オブジェクト | リクエストに含まれる資産ペアの[**AMM詳細オブジェクト**](#amm詳細オブジェクト)です。 |
|
||||
| `ledger_current_index` | [レジャーインデックス][] | _(`ledger_index`の指定がある場合は省略)_ この情報を取得する際に使用された、現在の進行中の台帳の[レジャーインデックス][]。 |
|
||||
| `ledger_hash` | [ハッシュ][] | _(`ledger_current_index`の指定がある場合は省略)_ この情報を取得する際に使用された台帳のバージョンの識別ハッシュ。 |
|
||||
| `ledger_index` | [レジャーインデックス][] | _(`ledger_current_index`の指定がある場合は省略_ この情報を取得する際に使用した台帳のバージョンの[レジャーインデックス][]。 |
|
||||
| `validated` | 真偽値 | もし`true`なら、このリクエストに使用された台帳は検証済みで、これらの結果は最終的なものです。もし省略されるか `false` に設定されると、データは未確定で変更される可能性があります。 |
|
||||
|
||||
|
||||
### AMM詳細オブジェクト
|
||||
|
||||
フィールド `amm` は、台帳上の自動マーケットメーカー(AMM)の現在の状態を記述するオブジェクトであり、以下のフィールドを含みます。
|
||||
|
||||
| フィールド | 型 | 説明 |
|
||||
|-----------------|------------|-------------|
|
||||
| `amm_account` | 文字列 | AMMアカウントの[アドレス][]です。 |
|
||||
| `amount` | [通貨額][] | AMMのプールにある1つの資産の合計額。(注記:リクエストに指定した`asset` _または_ `asset2`になります。) |
|
||||
| `amount2` | [通貨額][] | AMMのプール内の他の資産の合計額。(注意:リクエストに指定した`asset` _または_ `asset2`になります。) |
|
||||
| `asset_frozen` | 真偽値 | _(XRPの場合、省略)_ `true`の場合、`amount`の通貨は現在[凍結](freezes.html)されています。 |
|
||||
| `asset2_frozen` | 真偽値 | _(XRPの場合、省略)_ `true`の場合、`amount2`の通貨は現在[凍結](freezes.html)されています。 |
|
||||
| `auction_slot` | オブジェクト | _(省略される場合があります)_ 存在する場合、現在のオークションスロットの所有者を記述した[オークションスロットオブジェクト](#オークションスロットオブジェクト)です。 |
|
||||
| `lp_token` | [通貨額][] | このAMMのLPトークンの発行残高の合計。 |
|
||||
| `trading_fee` | 数値 | AMMの現在の取引手数料。単位は1/100,000で、1は0.001%の手数料に相当します。 |
|
||||
| `vote_slots` | 配列 | _(省略される場合があります)_ AMMの取引手数料に対する現在の投票数。[投票スロットオブジェクト](#投票スロットオブジェクト)として表示されます。 |
|
||||
|
||||
|
||||
### オークションスロットオブジェクト
|
||||
|
||||
`AMM` オブジェクトの `auction_slot` フィールドは、AMMの現在のオークションスロット保持者を表し、以下のフィールドを含みます。
|
||||
|
||||
| フィールド | 型 | 説明 |
|
||||
|------------------|-----------|-------------|
|
||||
| `account` | 文字列 | オークションスロットを所有するアカウントの[アドレス][]です。 |
|
||||
| `auth_accounts` | 配列 | オークションスロットの所有者が、取引手数料の割引の対象として指定した追加アカウントのリスト。この配列の各メンバーは、1つのフィールド `account` を持つオブジェクトで、指定したアカウントのアドレスが含まれています。 |
|
||||
| `discounted_fee` | 数値 | このAMMに対して取引を行う際に、オークションスロットの保有者、および対象となるアカウントに適用される割引後の取引手数料です。これは常に0です。 |
|
||||
| `expiration` | 文字列 | このオークションスロットが期限切れとなるISO8601 UTCタイムスタンプ。期限切れになると、オークションスロットは適用されません (ただし、別のトランザクションで置き換えられるかクリーンアップされるまで、データは台帳に残ります)。 |
|
||||
| `price` | [通貨額][] | オークションスロット所有者がオークションスロットを獲得するために支払った金額(LPトークン単位)です。これは、現在のスロット所有者を競り落とすための価格に影響します。 |
|
||||
| `time_interval` | 数値 | このオークションスロットが現在入っている72分の時間間隔を0から19までで指定します。オークションスロットは24時間後(72分間隔で20回)に失効し、現在の保有者を競り落とすためのコストと、誰かが競り落とした場合に現在の保有者が払い戻される金額に影響します。 |
|
||||
|
||||
|
||||
### 投票スロットオブジェクト
|
||||
|
||||
`vote_slots`配列の各項目は、取引手数料を設定するための流動性供給者の投票権を表し、以下のフィールドを含みます。
|
||||
|
||||
| フィールド | 型 | 説明 |
|
||||
|---------------|-------|-------------|
|
||||
| `account` | 文字列 | この流動性供給者の[アドレス][]。 |
|
||||
| `trading_fee` | 数値 | この流動性供給者が投票した取引手数料。単位は1/100,000です。 |
|
||||
| `vote_weight` | 数値 | この流動性供給者の投票が、最終的な取引手数料にどれだけカウントさ れるかを表します。これは、この流動性供給者がAMMのLPトークンをどれだけ保有しているかに比例します。値は、この流動性供給者が保有するこのLPトークンの数の100,000倍を、発行済LPトークンの総数で割ったものになります。例えば、値が1000の場合、流動性供給者はこのAMMのLPトークンの1%を保有していることを意味します。 |
|
||||
|
||||
|
||||
### 考えられるエラー
|
||||
|
||||
- [汎用エラータイプ][]のすべて。
|
||||
- `actNotFound` - この資産ペアのAMMが存在しないか、リクエストで指定された発行アカウントが存在しません。
|
||||
- `invalidParams` - 1つまたは複数のフィールドの指定に誤りがあるか、1つまたは複数の必須フィールドが欠落しています。
|
||||
|
||||
|
||||
## 関連項目
|
||||
|
||||
- [AMMオブジェクト](amm.html) - AMMオブジェクトの正規の保存形式
|
||||
- [AMMBid][] - オークションスロットと入札の仕組みについての詳細はこちら
|
||||
- [AMMVote][] - 取引手数料の投票メカニズムの詳細はこちら
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,260 +0,0 @@
|
||||
---
|
||||
html: amm_info.html
|
||||
parent: path-and-order-book-methods.html
|
||||
blurb: Get info about an Automted Market Maker (AMM) instance.
|
||||
status: not_enabled
|
||||
labels:
|
||||
- Decentralized Exchange
|
||||
- Cross-Currency
|
||||
- AMM
|
||||
---
|
||||
# amm_info
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/rpc/handlers/AMMInfo.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
The `{{currentpage.name}}` method gets information about an Automated Market Maker (AMM) instance.
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
|
||||
### Request Format
|
||||
|
||||
An example of the request format:
|
||||
|
||||
{% include '_snippets/no-cli-syntax.md' %}
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"command": "{{currentpage.name}}",
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```json
|
||||
{
|
||||
"method": "{{currentpage.name}}",
|
||||
"params": [{
|
||||
"asset": {
|
||||
"currency": "XRP"
|
||||
},
|
||||
"asset2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
}
|
||||
}]
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
[Try it! >](websocket-api-tool.html?server=wss%3A%2F%2Famm.devnet.rippletest.net%3A51233%2F#amm_info)
|
||||
|
||||
The request includes the following parameters:
|
||||
|
||||
| `Field` | Type | Description |
|
||||
|:---------|:-----------------|:-----------------------------------|
|
||||
| `asset` | Object or String | One of the assets of the AMM to look up, as an object with `currency` and `issuer` fields (omit `issuer` for XRP), like [currency amounts][Currency Amount]. For XRP, you can specify as the string `XRP` instead of as an object. |
|
||||
| `asset2` | Object or String | The other of the assets of the AMM, as an object with `currency` and `issuer` fields (omit `issuer` for XRP), like [currency amounts][Currency Amount]. |
|
||||
|
||||
|
||||
### Response Format
|
||||
|
||||
An example of a successful response:
|
||||
|
||||
<!-- MULTICODE_BLOCK_START -->
|
||||
|
||||
*WebSocket*
|
||||
|
||||
```json
|
||||
{
|
||||
"result": {
|
||||
"amm": {
|
||||
"amm_account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"amount": "296890496",
|
||||
"amount2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value": "25.81656470648473"
|
||||
},
|
||||
"asset2_frozen": false,
|
||||
"auction_slot": {
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"auth_accounts": [
|
||||
{
|
||||
"account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
|
||||
},
|
||||
{
|
||||
"account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
|
||||
}
|
||||
],
|
||||
"discounted_fee": 0,
|
||||
"expiration": "2023-Jan-26 00:28:40.000000000 UTC",
|
||||
"price": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "0"
|
||||
},
|
||||
"time_interval": 0
|
||||
},
|
||||
"lp_token": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "87533.41976112682"
|
||||
},
|
||||
"trading_fee": 600,
|
||||
"vote_slots": [
|
||||
{
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"trading_fee": 600,
|
||||
"vote_weight": 9684
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_current_index": 316725,
|
||||
"validated": false
|
||||
},
|
||||
"status": "success",
|
||||
"type": "response"
|
||||
}
|
||||
```
|
||||
|
||||
*JSON-RPC*
|
||||
|
||||
```json
|
||||
200 OK
|
||||
|
||||
{
|
||||
"result": {
|
||||
"amm": {
|
||||
"amm_account": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"amount": "296890496",
|
||||
"amount2": {
|
||||
"currency": "TST",
|
||||
"issuer": "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value": "25.81656470648473"
|
||||
},
|
||||
"asset2_frozen": false,
|
||||
"auction_slot": {
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"auth_accounts": [
|
||||
{
|
||||
"account": "r3f2WpQMsAd8k4Zoijv2PZ78EYFJ2EdvgV"
|
||||
},
|
||||
{
|
||||
"account": "rnW8FAPgpQgA6VoESnVrUVJHBdq9QAtRZs"
|
||||
}
|
||||
],
|
||||
"discounted_fee": 0,
|
||||
"expiration": "2023-Jan-26 00:28:40.000000000 UTC",
|
||||
"price": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "0"
|
||||
},
|
||||
"time_interval": 0
|
||||
},
|
||||
"lp_token": {
|
||||
"currency": "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer": "rp9E3FN3gNmvePGhYnf414T2TkUuoxu8vM",
|
||||
"value": "87533.41976112682"
|
||||
},
|
||||
"trading_fee": 600,
|
||||
"vote_slots": [
|
||||
{
|
||||
"account": "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"trading_fee": 600,
|
||||
"vote_weight": 9684
|
||||
}
|
||||
]
|
||||
},
|
||||
"ledger_current_index": 316745,
|
||||
"status": "success",
|
||||
"validated": false
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<!-- MULTICODE_BLOCK_END -->
|
||||
|
||||
The response follows the [standard format][], with a successful result containing the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|:-----------------------|:-----------------|:----------------------------------------------------------|
|
||||
| `amm` | Object | An [**AMM Description Object**](#amm-description-object) for the requested asset pair. |
|
||||
| `ledger_current_index` | [Ledger Index][] | _(Omitted if `ledger_index` is provided instead)_ The [ledger index][] of the current in-progress ledger, which was used when retrieving this information. |
|
||||
| `ledger_hash` | [Hash][] | _(Omitted if `ledger_current_index` is provided instead)_ The identifying hash of the ledger version that was used when retrieving this data. |
|
||||
| `ledger_index` | [Ledger Index][] | _(Omitted if `ledger_current_index` is provided instead)_ The [ledger index][] of the ledger version used when retrieving this information. |
|
||||
| `validated` | Boolean | If `true`, the ledger used for this request is validated and these results are final; if omitted or set to `false`, the data is pending and may change. |
|
||||
|
||||
|
||||
### AMM Description Object
|
||||
|
||||
The `amm` field is an object describing the current status of an Automated Market Maker (AMM) in the ledger, and contains the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|-----------------|---------------------|-------------|
|
||||
| `amm_account` | String | The [Address][] of the AMM Account. |
|
||||
| `amount` | [Currency Amount][] | The total amount of one asset in the AMM's pool. (Note: This could be `asset` _or_ `asset2` from the request.) |
|
||||
| `amount2` | [Currency Amount][] | The total amount of the other asset in the AMM's pool. (Note: This could be `asset` _or_ `asset2` from the request.) |
|
||||
| `asset_frozen` | Boolean | _(Omitted for XRP)_ If `true`, the `amount` currency is currently [frozen](freezes.html). |
|
||||
| `asset2_frozen` | Boolean | _(Omitted for XRP)_ If `true`, the `amount2` currency is currently [frozen](freezes.html). |
|
||||
| `auction_slot` | Object | _(May be omitted)_ An [Auction Slot Object](#auction-slot-object) describing the current auction slot holder, if there is one. |
|
||||
| `lp_token` | [Currency Amount][] | The total amount of this AMM's LP Tokens outstanding. |
|
||||
| `trading_fee` | Number | The AMM's current trading fee, in units of 1/100,000; a value of 1 is equivalent to a 0.001% fee. |
|
||||
| `vote_slots` | Array | _(May be omitted)_ The current votes for the AMM's trading fee, as [Vote Slot Objects](#vote-slot-objects). |
|
||||
|
||||
|
||||
### Auction Slot Object
|
||||
|
||||
The `auction_slot` field of the `amm` object describes the current auction slot holder of the AMM, and contains the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|------------------|---------------------|-------------|
|
||||
| `account` | String | The [Address][] of the account that owns the auction slot. |
|
||||
| `auth_accounts` | Array | A list of additional accounts that the auction slot holder has designated as being eligible of the discounted trading fee. Each member of this array is an object with one field, `account`, containing the address of the designated account. |
|
||||
| `discounted_fee` | Number | The discounted trading fee that applies to the auction slot holder, and any eligible accounts, when trading against this AMM. This is always 0. |
|
||||
| `expiration` | String | The ISO 8601 UTC timestamp after which this auction slot expires. After expired, the auction slot does not apply (but the data can remain in the ledger until another transaction replaces it or cleans it up). |
|
||||
| `price` | [Currency Amount][] | The amount, in LP Tokens, that the auction slot holder paid to win the auction slot. This affects the price to outbid the current slot holder. |
|
||||
| `time_interval` | Number | The current 72-minute time interval this auction slot is in, from 0 to 19. The auction slot expires after 24 hours (20 intervals of 72 minutes) and affects the cost to outbid the current holder and how much the current holder is refunded if someone outbids them. |
|
||||
|
||||
|
||||
### Vote Slot Objects
|
||||
|
||||
Each entry in the `vote_slots` array represents one liquidity provider's vote to set the trading fee, and contains the following fields:
|
||||
|
||||
| Field | Type | Description |
|
||||
|---------------|--------|-------------|
|
||||
| `account` | String | The [Address][] of this liquidity provider. |
|
||||
| `trading_fee` | Number | The trading fee this liquidity provider voted for, in units of 1/100,000. |
|
||||
| `vote_weight` | Number | How much this liquidity provider's vote counts towards the final trading fee. This is proportional to how much of the AMM's LP Tokens this liquidity provider holds. The value is equal to 100,000 times the number of this LP Tokens this liquidity provider holds, divided by the total number of LP Tokens outstanding. For example, a value of 1000 means that the liquidity provider holds 1% of this AMM's LP Tokens. |
|
||||
|
||||
|
||||
### Possible Errors
|
||||
|
||||
- Any of the [universal error types][].
|
||||
- `actNotFound` - The AMM for this asset pair does not exist, or an issuing account specified in the request does not exist.
|
||||
- `invalidParams` - One or more fields are specified incorrectly, or one or more required fields are missing.
|
||||
|
||||
|
||||
## See Also
|
||||
|
||||
- [AMM object](amm.html) - The canonical storage format of the AMM object
|
||||
- [AMMBid][] - More info on the auction slot and bidding mechanism
|
||||
- [AMMVote][] - More info on the trading fee voting mechanism
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,116 +0,0 @@
|
||||
---
|
||||
html: amm.html
|
||||
parent: ledger-object-types.html
|
||||
blurb: 自動マーケットメーカー(AMM)インスタンスの定義と詳細。
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMM
|
||||
[[Source]](https://github.com/xrplf/rippled/blob/c1e4bfb08bcc9f187d794a71d653003a6148dc68/src/ripple/protocol/impl/LedgerFormats.cpp#L265-L275 "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
`AMM`オブジェクトは、単一の[自動マーケットメーカー](automated-market-makers.html)(AMM)インスタンスを表します。
|
||||
|
||||
|
||||
## AMM JSONの例
|
||||
|
||||
```json
|
||||
{
|
||||
"AMMAccount" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"Asset" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"AuctionSlot" : {
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"AuthAccounts" : [
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rMKXGCbJ5d8LbrqthdG46q3f969MVK2Qeg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rBepJuTLFJt3WmtLXYAxSjtBWAeQxVbncv"
|
||||
}
|
||||
}
|
||||
],
|
||||
"DiscountedFee" : 0,
|
||||
"Expiration" : 721870180,
|
||||
"Price" : {
|
||||
"currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"value" : "0.8696263565463045"
|
||||
}
|
||||
},
|
||||
"Flags" : 0,
|
||||
"LPTokenBalance" : {
|
||||
"currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"value" : "71150.53584131501"
|
||||
},
|
||||
"TradingFee" : 600,
|
||||
"VoteSlots" : [
|
||||
{
|
||||
"VoteEntry" : {
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"TradingFee" : 600,
|
||||
"VoteWeight" : 100000
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## AMM フィールド
|
||||
|
||||
`AMM`オブジェクトは以下のフィールドを持ちます。
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:-----------------|:--------------------|:------------------|:----------|--------------|
|
||||
| `Asset` | オブジェクト | STIssue | はい | このAMMが保有する2つのアセットのうちの1つの定義。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります。 |
|
||||
| `Asset2` | オブジェクト | STIssue | はい | このAMMが保有するもう一つの資産の定義。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります。 |
|
||||
| `AMMAccount` | 文字列 | AccountID | はい | このAMMの資産を保有する[特殊なアカウント](accountroot.html#ammの特殊なaccountrootオブジェクト)のアドレス。 |
|
||||
| `AuctionSlot` | オブジェクト | STObject | いいえ | オークションスロットの現在の所有者の詳細。[オークションスロットオブジェクト](#オークションスロットオブジェクト)形式です。|
|
||||
| `LPTokenBalance` | [通貨額][] | Amount | はい | AMMインスタンスの流動性供給者トークンの発行残高の合計。このトークンの保有者は、保有量に比例してAMMの取引手数料に投票したり、取引手数料の徴収とともに増えていくAMMの資産の一部とトークンを交換したりすることができます。 |
|
||||
| `TradingFee` | 数値 | UInt16 | はい | AMMインスタンスに対する取引に課される手数料のパーセンテージを1/100,000の単位で指定します。最大値は1000で、これは1%の手数料となります。 |
|
||||
| `VoteSlots` | 配列 | STArray | いいえ | プールの取引手数料に関する投票を表す、投票オブジェクトのリスト。|
|
||||
|
||||
### オークションスロットオブジェクト
|
||||
|
||||
`AuctionSlot`フィールドは、以下のネストしたフィールドを持つオブジェクトを含んでいます。
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:----------------|:--------------------|:------------------|:----------|:--|
|
||||
| `Account` | 文字列 - アドレス | AccountID | はい | このオークションスロットの現在の所有者。 |
|
||||
| `AuthAccounts` | 配列 | STArray | いいえ | AMMインスタンスに対して取引手数料を割引した価格で取引することを許可された、最大4つの追加アカウントのリスト。 |
|
||||
| `DiscountedFee` | 文字列 | UInt32 | はい | オークションの所有者に請求される取引手数料で、`TradingFee`と同じフォーマットです。デフォルトでは0で、オークションスロットの所有者はAMMの標準的な手数料の代わりに、手数料なしで取引できることを意味します。 |
|
||||
| `Price` | [通貨額][] | Amount | はい | オークションスロットの所有者がこのスロットを落札するために支払った金額(LPトークン)。 |
|
||||
| `Expiration` | 文字列 | UInt32 | はい | このスロットの有効期限が切れる[Rippleエポック以降の経過秒数][]で指定した時刻。 |
|
||||
|
||||
## AMM フラグ
|
||||
|
||||
現在、`AMM`オブジェクトに定義されているフラグはありません。
|
||||
|
||||
## AMM ID フォーマット
|
||||
|
||||
`AMM`オブジェクトのIIは、以下の値の[SHA-512Half][]を順に繋げたものです。
|
||||
|
||||
1. `AMM`のスペースキー(`0x0041`)
|
||||
0. 第1アセットの発行者のAccountID。
|
||||
0. 第1トークンの160ビットの通貨コード。
|
||||
0. 第2アセットの発行者のAccountID。
|
||||
0. 第2トークンの160ビットの通貨コード。
|
||||
|
||||
XRPの場合、トークン・発行者ともに全て0を使用します。
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,116 +0,0 @@
|
||||
---
|
||||
html: amm.html
|
||||
parent: ledger-object-types.html
|
||||
blurb: The definition and details of an Automated Market Maker (AMM) instance.
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMM
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/c1e4bfb08bcc9f187d794a71d653003a6148dc68/src/ripple/protocol/impl/LedgerFormats.cpp#L265-L275 "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
The `AMM` object type describes a single [Automated Market Maker](automated-market-makers.html) (AMM) instance.
|
||||
|
||||
|
||||
## Example AMM JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"AMMAccount" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"Asset" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"AuctionSlot" : {
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"AuthAccounts" : [
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rMKXGCbJ5d8LbrqthdG46q3f969MVK2Qeg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rBepJuTLFJt3WmtLXYAxSjtBWAeQxVbncv"
|
||||
}
|
||||
}
|
||||
],
|
||||
"DiscountedFee" : 0,
|
||||
"Expiration" : 721870180,
|
||||
"Price" : {
|
||||
"currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"value" : "0.8696263565463045"
|
||||
}
|
||||
},
|
||||
"Flags" : 0,
|
||||
"LPTokenBalance" : {
|
||||
"currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"value" : "71150.53584131501"
|
||||
},
|
||||
"TradingFee" : 600,
|
||||
"VoteSlots" : [
|
||||
{
|
||||
"VoteEntry" : {
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"TradingFee" : 600,
|
||||
"VoteWeight" : 100000
|
||||
}
|
||||
}
|
||||
]
|
||||
}
|
||||
```
|
||||
|
||||
## AMM Fields
|
||||
|
||||
The `AMM` object has the following fields:
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:-----------------|:--------------------|:------------------|:----------|--------------|
|
||||
| `Asset` | Object | STIssue | Yes | The definition for one of the two assets this AMM holds. In JSON, this is an object with `currency` and `issuer` fields. |
|
||||
| `Asset2` | Object | STIssue | Yes | The definition for the other asset this AMM holds. In JSON, this is an object with `currency` and `issuer` fields. |
|
||||
| `AMMAccount` | String | AccountID | Yes | The address of the [special account](accountroot.html#special-amm-accountroot-objects) that holds this AMM's assets. |
|
||||
| `AuctionSlot` | Object | STObject | No | Details of the current owner of the auction slot, as an [Auction Slot object](#auction-slot-object). |
|
||||
| `LPTokenBalance` | [Currency Amount][] | Amount | Yes | The total outstanding balance of liquidity provider tokens from this AMM instance. The holders of these tokens can vote on the AMM's trading fee in proportion to their holdings, or redeem the tokens for a share of the AMM's assets which grows with the trading fees collected. |
|
||||
| `TradingFee` | Number | UInt16 | Yes | The percentage fee to be charged for trades against this AMM instance, in units of 1/100,000. The maximum value is 1000, for a 1% fee. |
|
||||
| `VoteSlots` | Array | STArray | No | A list of vote objects, representing votes on the pool's trading fee. |
|
||||
|
||||
### Auction Slot Object
|
||||
|
||||
The `AuctionSlot` field contains an object with the following nested fields:
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:----------------|:--------------------|:------------------|:----------|:--|
|
||||
| `Account` | String - Address | AccountID | Yes | The current owner of this auction slot. |
|
||||
| `AuthAccounts` | Array | STArray | No | A list of at most 4 additional accounts that are authorized to trade at the discounted fee for this AMM instance. |
|
||||
| `DiscountedFee` | String | UInt32 | Yes | The trading fee to be charged to the auction owner, in the same format as `TradingFee`. By default this is 0, meaning that the auction owner can trade at no fee instead of the standard fee for this AMM. |
|
||||
| `Price` | [Currency Amount][] | Amount | Yes | The amount the auction owner paid to win this slot, in LP Tokens. |
|
||||
| `Expiration` | String | UInt32 | Yes | The time when this slot expires, in [seconds since the Ripple Epoch][]. |
|
||||
|
||||
## AMM Flags
|
||||
|
||||
There are currently no flags defined for `AMM` objects.
|
||||
|
||||
## AMM ID Format
|
||||
|
||||
The ID of an `AMM` object is the [SHA-512Half][] of the following values, concatenated in order:
|
||||
|
||||
1. The `AMM` space key (`0x0041`)
|
||||
0. The AccountID of the first asset's issuer.
|
||||
0. The 160-bit currency code of the first token.
|
||||
0. The AccountID of the second asset's issuer.
|
||||
0. The 160-bit currency code of the second token.
|
||||
|
||||
For XRP, use all 0's for both the token and the issuer.
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,139 +0,0 @@
|
||||
---
|
||||
html: ammbid.html
|
||||
parent: transaction-types.html
|
||||
blurb: 自動マーケットメーカーのオークションスロットに入札することで、手数料の割引を受けることができます。
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMBid
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMBid.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
[自動マーケットメーカー](automated-market-makers.html)のオークションスロットに入札することができます。落札されると、競り落とされるか24時間が経過するまで、割引料金でAMMと取引することができます。24時間が経過する前に競り落とされた場合、残り時間に応じて落札価格の一部が払い戻されます。
|
||||
|
||||
AMMのLPトークンを使って落札すると、落札額はAMMに返金され、LPトークンの残高が減ります。
|
||||
|
||||
|
||||
## {{currentpage.name}} JSONの例
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Asset" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"AuthAccounts" : [
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rMKXGCbJ5d8LbrqthdG46q3f969MVK2Qeg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rBepJuTLFJt3WmtLXYAxSjtBWAeQxVbncv"
|
||||
}
|
||||
}
|
||||
],
|
||||
"BidMax" : {
|
||||
"currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"value" : "100"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 2147483648,
|
||||
"Sequence" : 9,
|
||||
"TransactionType" : "AMMBid"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.ja.md' %}
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:---------------|:-----------|:- ----------|:----- |:------------|
|
||||
| `Asset` | オブジェクト | STIssue | はい | AMMのプールにある資産の一つを定義します。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。 |
|
||||
| `Asset2` | オブジェクト | STIssue | はい | AMM のプールにあるもう一つのアセットの定義です。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。 |
|
||||
| `BidMin` | [通貨額][] | Amount | いいえ | スロットに支払う最小の金額。この値を高く設定すると、他の人から競り落とされにくくなります。省略された場合は、落札に必要な最低額を支払います。 |
|
||||
| `BidMax` | [通貨額][] | Amount | いいえ | スロットに支払う最大の金額。落札するためのコストがこの金額より高い場合、取引は失敗します。省略された場合は、落札に必要な金額を支払います。 |
|
||||
| `AuthAccounts` | 配列 | STArray | いいえ | 割引料金で取引を許可する最大4つの追加のアカウントのリスト。これには、トランザクション送信者のアドレスは含めることはできません。これらのオブジェクトはそれぞれ[Auth Accountオブジェクト](#auth-accountオブジェクト)である必要があります。. |
|
||||
|
||||
`BidMin` と `BidMax` の両方を指定することはできません。
|
||||
|
||||
### Auth Accountオブジェクト
|
||||
|
||||
`AuthAccounts` 配列の各メンバーは、以下のフィールドを持つオブジェクトである必要があります。
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:---------------|:----------|:-------------|:-----|:------------|
|
||||
| `Account` | 文字列 | AccountID | はい | 認可するアカウントのアドレス。 |
|
||||
|
||||
配列に現れる他の「内部オブジェクト」と同様に、これらのオブジェクトのJSON表現は、オブジェクトタイプ`AuthAccount`のみをキーとするオブジェクトにラップされています。
|
||||
|
||||
## オークションスロットの価格
|
||||
|
||||
落札された場合、トランザクションは自動的に前のスロット所有者を競り落とし、送信者のLPトークンから落札価格が引き落とされます。落札価格は、72分ずつ20回に区切られた時間経過とともに減少します。もし送信者が落札するのに十分なLPトークンを持っていなかったり、入札価格がトランザクションの`BidMax`値より高い場合、トランザクションは`tecAMM_FAILED_BID`という結果で失敗します。
|
||||
|
||||
- オークションスロットが現在空であったり、期限切れ、または最後のインターバルである場合、**最低入札価格**はAMMの総LPトークン残高の**0.001%**です。
|
||||
|
||||
**注意:** この最小値は暫定値であり、AMM機能が最終的に完成する前に変更される可能性があります。
|
||||
|
||||
- それ以外の場合、現在の保有者に競り勝つための価格は、以下の式で計算されます。
|
||||
|
||||
P = B × 1.05 × (1 - t⁶⁰) + M
|
||||
|
||||
- `P`: 競り落とすための価格。単位はLPトークン。
|
||||
- `B`: 現在の入札価格。単位はLPトークン。
|
||||
- `t`: 現在の24時間枠で経過した時間の割合。0.05の倍数に切り捨てられる。
|
||||
- `M`: M`は上記で定義された**最低入札価格**。
|
||||
|
||||
競り落とすためのコストには、2つの特殊なケースがあります。誰かが落札してから**最初の時間枠**では、その人を競り落とすための価格は、最低入札価格+既存の入札価格の5%アップとなります。
|
||||
|
||||
P = B × 1.05 + M
|
||||
|
||||
スロットの**最後の時間枠**では、誰かを競り落とすためのコストは最低入札額のみです。
|
||||
|
||||
P = M
|
||||
|
||||
**注記:** 台帳を作成する際に、ネットワーク上のすべてのサーバーが同じ結果になるように、時間の計測は前回の台帳の[正規の終了時刻](ledgers.html#ledger-close-times) に基づいており、これはおおよその目安の時間です。
|
||||
|
||||
## 払い戻し
|
||||
|
||||
アクティブなオークションスロットを競り落とした場合、AMMは以下の計算式で前ホルダーに価格の一部を払い戻します。
|
||||
|
||||
```text
|
||||
R = B × (1 - t)
|
||||
```
|
||||
|
||||
- `R`: は返金する金額。単位はLPトークン。
|
||||
- `B`: 払い戻しの対象となる前回の入札の価格。単位はLPトークン。
|
||||
- `t`: 現在の24時間枠で経過した時間の割合。0.05の倍数に切り捨てられる。
|
||||
|
||||
特殊なケースとして、オークションスロットの最終(20番目)区間では、払い戻し額は0となる。
|
||||
|
||||
**注記:** XRP Ledgerの時刻と同様に、トランザクション処理では _前回の_ 台帳の[正規の終了時刻](ledgers.html#ledger-close-times)を使用するため、実時間と最大で約10秒の差が生じる場合があります。
|
||||
|
||||
|
||||
## エラーケース
|
||||
すべてのトランザクションで発生する可能性のあるエラーに加えて、{{currentpage.name}}トランザクションでは、次の[トランザクション結果コード](transaction-results.html)が発生する可能性があります。
|
||||
|
||||
| エラーコード | 説明 |
|
||||
|:------------------------|:---------------------------------------------|
|
||||
| `tecAMM_FAILED_BID` | このトランザクションでは、送信者が必要な入札額を支払うために十分なLPトークンを保有していないか、落札価格がトランザクションで指定された`BidMax`値より高いため、落札できませんでした。 |
|
||||
| `tecAMM_INVALID_TOKENS` | このトランザクションの送信者は、スロット価格に見合うだけのLPトークンを保有していません。 |
|
||||
| `temBAD_AMM_TOKENS` | 指定された`BidMin`または`BidMax`は、このAMMの正しいLPトークンとして指定されていません。 |
|
||||
| `temBAD_AMM_OPTIONS` | トランザクションが無効なオプションを指定しました。例えば、`AuthAccounts`のリストが長すぎるか、`BidMin`とBidMax` の両方を指定しています。 |
|
||||
| `temDISABLED` | このネットワークでは、AMM機能 :not_enabled: は有効ではありません。 |
|
||||
| `terNO_ACCOUNT` | このリクエストで指定されたアカウントのいずれかが存在しません。 |
|
||||
| `terNO_AMM` | このトランザクションの資産ペアの自動マーケットメーカーのインスタンスが存在しません。 |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,139 +0,0 @@
|
||||
---
|
||||
html: ammbid.html
|
||||
parent: transaction-types.html
|
||||
blurb: Bid on an Automated Market Maker's auction slot, which grants a discounted fee.
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMBid
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMBid.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
Bid on an [Automated Market Maker](automated-market-makers.html)'s (AMM's) auction slot. If you win, you can trade against the AMM at a discounted fee until you are outbid or 24 hours have passed. If you are outbid before 24 hours have passed, you are refunded part of the cost of your bid based on how much time remains.
|
||||
|
||||
You bid using the AMM's LP Tokens; the amount of a winning bid is returned to the AMM, decreasing the outstanding balance of LP Tokens.
|
||||
|
||||
|
||||
## Example {{currentpage.name}} JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Asset" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"AuthAccounts" : [
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rMKXGCbJ5d8LbrqthdG46q3f969MVK2Qeg"
|
||||
}
|
||||
},
|
||||
{
|
||||
"AuthAccount" : {
|
||||
"Account" : "rBepJuTLFJt3WmtLXYAxSjtBWAeQxVbncv"
|
||||
}
|
||||
}
|
||||
],
|
||||
"BidMax" : {
|
||||
"currency" : "039C99CD9AB0B70B32ECDA51EAAE471625608EA2",
|
||||
"issuer" : "rE54zDvgnghAoPopCgvtiqWNq3dU5y836S",
|
||||
"value" : "100"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 2147483648,
|
||||
"Sequence" : 9,
|
||||
"TransactionType" : "AMMBid"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:---------------|:--------------------|:------------------|:----------|:------------|
|
||||
| `Asset` | Object | STIssue | Yes | The definition for one of the assets in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `Asset2` | Object | STIssue | Yes | The definition for the other asset in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `BidMin` | [Currency Amount][] | Amount | No | Pay at least this amount for the slot. Setting this value higher makes it harder for others to outbid you. If omitted, pay the minimum necessary to win the bid. |
|
||||
| `BidMax` | [Currency Amount][] | Amount | No | Pay at most this amount for the slot. If the cost to win the bid is higher than this amount, the transaction fails. If omitted, pay as much as necessary to win the bid. |
|
||||
| `AuthAccounts` | Array | STArray | No | A list of up to 4 additional accounts that you allow to trade at the discounted fee. This cannot include the address of the transaction sender. Each of these objects should be an [Auth Account object](#auth-account-objects). |
|
||||
|
||||
You cannot specify both `BidMin` and `BidMax`.
|
||||
|
||||
### Auth Account Objects
|
||||
|
||||
Each member of the `AuthAccounts` array must be an object with the following field:
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:---------------|:----------|:------------------|:----------|:------------|
|
||||
| `Account` | String | AccountID | Yes | The address of the account to authorize. |
|
||||
|
||||
Like other "inner objects" that can appear in arrays, the JSON representation of each of these objects is wrapped in an object whose only key is the object type, `AuthAccount`.
|
||||
|
||||
## Auction Slot Price
|
||||
|
||||
If successful, the transaction automatically outbids the previous slot owner and debits the bid price from the sender's LP Tokens. The price to win the auction decreases over time, divided into 20 intervals of 72 minutes each. If the sender does not have enough LP Tokens to win the bid, or the price of the bid is higher than the transaction's `BidMax` value, the transaction fails with a `tecAMM_FAILED_BID` result.
|
||||
|
||||
- If the auction slot is currently empty, expired, or in its last interval, the **minimum bid** is **0.001% of the AMM's total LP Tokens balance**.
|
||||
|
||||
**Caution:** This minimum value is a placeholder and may change before the AMM feature becomes finalized.
|
||||
|
||||
- Otherwise, the price to outbid the current holder is calculated using the following formula:
|
||||
|
||||
P = B × 1.05 × (1 - t⁶⁰) + M
|
||||
|
||||
- `P` is the price to outbid, in LP Tokens.
|
||||
- `B` is the price of the current bid, in LP Tokens.
|
||||
- `t` is the fraction of time elapsed in the current 24-hour slot, rounded down to a multiple of 0.05.
|
||||
- `M` is the **minimum bid** as defined above.
|
||||
|
||||
There are two special cases for the cost to outbid someone. In the **first interval** after someone wins the bid, the price to outbid them is the minimum bid plus 5% more than the existing bid:
|
||||
|
||||
P = B × 1.05 + M
|
||||
|
||||
In the **last interval** of someone's slot, the cost to outbid someone is only the minimum bid:
|
||||
|
||||
P = M
|
||||
|
||||
**Note:** To make sure all servers in the network reach the same results when building a ledger, time measurements are based on the [official close time](ledgers.html#ledger-close-times) of the previous ledger, which is approximate.
|
||||
|
||||
## Bid Refunds
|
||||
|
||||
When you outbid an active auction slot, the AMM refunds the previous holder part of the price, using this formula:
|
||||
|
||||
```text
|
||||
R = B × (1 - t)
|
||||
```
|
||||
|
||||
- `R` is the amount to refund, in LP Tokens.
|
||||
- `B` is the price of the previous bid to be refunded, in LP Tokens.
|
||||
- `t` is the fraction of time elapsed in the current 24-hour slot, rounded down to a multiple of 0.05.
|
||||
|
||||
As a special case, during the final (20th) interval of the auction slot, the refunded amount is zero.
|
||||
|
||||
**Note:** As with all XRP Ledger times, transaction processing uses the [official close time](ledgers.html#ledger-close-times) of the _previous_ ledger, which can result in a difference of up to about 10 seconds from real time.
|
||||
|
||||
|
||||
## Error Cases
|
||||
Besides errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):
|
||||
|
||||
| Error Code | Description |
|
||||
|:------------------------|:---------------------------------------------|
|
||||
| `tecAMM_FAILED_BID` | This transaction could not win the auction, either because the sender does not hold enough LP Tokens to pay the necessary bid or because the price to win the auction was higher than the transaction's specified `BidMax` value. |
|
||||
| `tecAMM_INVALID_TOKENS` | The sender of this transaction does not hold enough LP Tokens to meet the slot price. |
|
||||
| `temBAD_AMM_TOKENS` | The specified `BidMin` or `BidMax` were not specified as the correct LP Tokens for this AMM. |
|
||||
| `temBAD_AMM_OPTIONS` | The transaction specified invalid options, such as a list of `AuthAccounts` that is too long, or specifying both `BidMin` and `BidMax`. |
|
||||
| `temDISABLED` | The AMM feature :not_enabled: is not enabled on this network. |
|
||||
| `terNO_ACCOUNT` | One of the accounts specified in this request do not exist. |
|
||||
| `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,71 +0,0 @@
|
||||
---
|
||||
html: ammcreate.html
|
||||
parent: transaction-types.html
|
||||
blurb: 指定された資産ペアを取引するための新しい自動マーケットメーカーを作成します。
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMCreate
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMCreate.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
資産([代替可能トークン](tokens.html)または[XRP](xrp.html))のペアを取引するための新しい[自動マーケットメーカー](automated-market-makers.html)(AMM)インスタンスを作成します。
|
||||
|
||||
AMMを表す[AMMオブジェクト][]と[特殊なAccountRootオブジェクト](accountroot.html#ammの特殊なaccountrootオブジェクト)を作成します。また、両資産の開始残高の所有権を送信者から、作成された`AccountRoot`に移し、初期残高の流動性プロバイダトークン(LPトークン)をAMMアカウントから送信者に発行します。
|
||||
|
||||
**注意:** AMMを作成する際には、各資産を(ほぼ)同額ずつ投入する必要があります。そうしないと、他のユーザーがあなたの負担において、このAMMを使った取引で利益を得ることができます([アービトラージの実行](https://www.machow.ski/posts/an_introduction_to_automated_market_makers/#price-arbitrage))。流動性供給者が負う通貨リスクは、資産ペアのボラティリティ(不均衡の可能性)が高ければ高いほど、大きくなります。取引手数料が高いほど、このリスクを相殺することになりますので、資産ペアのボラティリティに応じて取引手数料を設定するとよいでしょう。
|
||||
|
||||
## {{currentpage.name}} JSONの例
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Amount" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value" : "25"
|
||||
},
|
||||
"Amount2" : "250000000",
|
||||
"Fee" : "10",
|
||||
"Flags" : 2147483648,
|
||||
"Sequence" : 6,
|
||||
"TradingFee" : 500,
|
||||
"TransactionType" : "AMMCreate"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
<!--{# fix md highlighting_ #}-->
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:-------------|:---- -----|:-----------|:------|:------------|
|
||||
| `Amount` | [通貨額][] | Amount | はい | このAMMの最初の資金となる2つの資産のうち、1つ目の資産です。これは正数である必要があります。 |
|
||||
| `Amount2` | [通貨額][] | Amount | はい | このAMMの最初の資金となる2つの資産のうち、2つ目の資産です。これは正数である必要があります。 |
|
||||
| `TradingFee` | 数値 | UInt16 | はい | このAMMインスタンスに対する取引に課される手数料を1/100,000単位で指定します(値1は0.001%に相当)。最大値は`1000`で、1%の手数料を意味します。最小値は `0`です。 |
|
||||
|
||||
`Amount`と`Amount2`の一方または両方は[tokens](tokens.html)であり、最大でどちらか一方を[XRP](xrp.html)にすることが可能です。通貨コードと発行者が同じものは使用できません。AMMのLPトークンは、別のAMMの資産の1つとして使用することができます。
|
||||
|
||||
## エラーケース
|
||||
|
||||
すべてのトランザクションで発生する可能性のあるエラーに加えて、{{currentpage.name}}トランザクションでは、次の[トランザクション結果コード](transaction-results.html)が発生する可能性があります。
|
||||
|
||||
| エラーコード | 説明 |
|
||||
|:--------------------|:---------------------------------------------|
|
||||
| `temDISABLED` | このネットワークでは、AMM機能 :not_enabled: は有効ではありません。 |
|
||||
| `temINVALID_FLAG` | トランザクションに無効な`Flags`値が指定されています。現在、このトランザクションタイプに定義されたフラグはないので、[グローバルフラグ](transaction-common-fields.html#グローバルフラグ)のみが許可されます。 |
|
||||
| `temBAD_AMM_TOKENS` | `Amount`と`Amount2`値が正しくありません。例えば、両方とも同じトークンを参照している場合です。 |
|
||||
| `temBAD_FEE` | `TradingFee`の値が不正です。ゼロまたは正の整数でなければならず、1000を超えることはできません。 |
|
||||
| `terNO_ACCOUNT` | リクエストで参照されたいずれかのアカウントが存在しません。|
|
||||
| `tecNO_AUTH` | 送信者は資産(`Amount`または`Amount2`)のいずれかを保有する権限がありません。 |
|
||||
| `tecNO_LINE` | 送信者は資産(`Amount`または`Amount2`)のうちいずれか1つに対するトラストラインを保有していません。 |
|
||||
| `tecFROZEN` | 資産(`Amount`または`Amount2`)の少なくとも1つが現在[凍結](freezes.html)されています。 |
|
||||
| `tecUNFUNDED_AMM` | 送信者は`Amount`と`Amount2`で指定された金額をAMMに入金するための十分な資金を保有していません。 |
|
||||
| `tecAMM_EXISTS` | この通貨ペアを扱っているAMMが既に存在しています。 |
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,71 +0,0 @@
|
||||
---
|
||||
html: ammcreate.html
|
||||
parent: transaction-types.html
|
||||
blurb: Create a new Automated Market Maker for trading a given pair of assets.
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMCreate
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMCreate.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
Create a new [Automated Market Maker](automated-market-makers.html) (AMM) instance for trading a pair of assets ([fungible tokens](tokens.html) or [XRP](xrp.html)).
|
||||
|
||||
Creates both an [AMM object][] and a [special AccountRoot object](accountroot.html#special-amm-accountroot-objects) to represent the AMM. Also transfers ownership of the starting balance of both assets from the sender to the created `AccountRoot` and issues an initial balance of liquidity provider tokens (LP Tokens) from the AMM account to the sender.
|
||||
|
||||
**Caution:** When you create the AMM, you should fund it with (approximately) equal-value amounts of each asset. Otherwise, other users can profit at your expense by trading with this AMM ([performing arbitrage](https://www.machow.ski/posts/an_introduction_to_automated_market_makers/#price-arbitrage)). The currency risk that liquidity providers take on increases with the volatility (potential for imbalance) of the asset pair. The higher the trading fee, the more it offsets this risk, so it's best to set the trading fee based on the volatility of the asset pair.
|
||||
|
||||
## Example {{currentpage.name}} JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Amount" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value" : "25"
|
||||
},
|
||||
"Amount2" : "250000000",
|
||||
"Fee" : "10",
|
||||
"Flags" : 2147483648,
|
||||
"Sequence" : 6,
|
||||
"TradingFee" : 500,
|
||||
"TransactionType" : "AMMCreate"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
<!--{# fix md highlighting_ #}-->
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:-------------|:--------------------|:------------------|:----------|:------------|
|
||||
| `Amount` | [Currency Amount][] | Amount | Yes | The first of the two assets to fund this AMM with. This must be a positive amount. |
|
||||
| `Amount2` | [Currency Amount][] | Amount | Yes | The second of the two assets to fund this AMM with. This must be a positive amount. |
|
||||
| `TradingFee` | Number | UInt16 | Yes | The fee to charge for trades against this AMM instance, in units of 1/100,000; a value of 1 is equivalent to 0.001%. The maximum value is `1000`, indicating a 1% fee. The minimum value is `0`. |
|
||||
|
||||
One or both of `Amount` and `Amount2` can be [tokens](tokens.html); at most one of them can be [XRP](xrp.html). They cannot both have the same currency code and issuer. An AMM's LP tokens _can_ be used as one of the assets for another AMM.
|
||||
|
||||
## Error Cases
|
||||
|
||||
Besides errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):
|
||||
|
||||
| Error Code | Description |
|
||||
|:--------------------|:---------------------------------------------|
|
||||
| `temDISABLED` | The AMM feature :not_enabled: is not enabled on this network. |
|
||||
| `temINVALID_FLAG` | The transaction specified an invalid `Flags` value. Since there are currently no flags defined for this transaction type, only [Global Flags](transaction-common-fields.html#global-flags) are allowed. |
|
||||
| `temBAD_AMM_TOKENS` | The values of `Amount` and `Amount2` are not valid: for example, both refer to the same token. |
|
||||
| `temBAD_FEE` | The `TradingFee` value is invalid. It must be zero or a positive integer and cannot be over 1000. |
|
||||
| `terNO_ACCOUNT` | One of the accounts referenced in the request does not exist. |
|
||||
| `tecNO_AUTH` | The sender is not authorized to hold one of the deposit assets (`Amount` or `Amount2`). |
|
||||
| `tecNO_LINE` | The sender does not have a trust line for one of the deposit assets (`Amount` or `Amount2`). |
|
||||
| `tecFROZEN` | At least one of the deposit assets (`Amount` or `Amount2`) is currently [frozen](freezes.html). |
|
||||
| `tecUNFUNDED_AMM` | The sender does not hold enough money to fund the AMM with the amounts specified in `Amount` and `Amount2`. |
|
||||
| `tecAMM_EXISTS` | There is already another AMM trading this currency pair. |
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,136 +0,0 @@
|
||||
---
|
||||
html: ammdeposit.html
|
||||
parent: transaction-types.html
|
||||
blurb: LPTokenと引き換えに、自動マーケットメーカーに資金を預けます。
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMDeposit
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMDeposit.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
[自動マーケットメーカー](automated-market-makers.html)(AMM)インスタンスに資金を預け、引き換えにAMMの流動性プロバイダートークン( _LPトークン_ )を受け取ります。AMMのプールにある資産の一方または両方を預けることができます。
|
||||
|
||||
トランザクションが成功すると、LPトークンを保持するためにAMMアカウント(リミット0)に[トラストライン](trust-lines-and-issuing.html)が作成されます。
|
||||
|
||||
## {{currentpage.name}} JSONの例
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Amount" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value" : "2.5"
|
||||
},
|
||||
"Amount2" : "30000000",
|
||||
"Asset" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 1048576,
|
||||
"Sequence" : 7,
|
||||
"TransactionType" : "AMMDeposit"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.ja.md' %}
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:--------------|:-----------|:-----------|:------|:------------|
|
||||
| `Asset` | オブジェクト | STIssue | はい | AMMのプールにある資産の一つを定義します。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。 |
|
||||
| `Asset2` | オブジェクト | STIssue | はい | AMMのプールにあるもう一つの資産を定義します。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。 |
|
||||
| `Amount` | [通貨額][] | Amount | いいえ | AMMに預ける1つの資産の量を指定します。存在する場合、これはAMMのプールにある資産の一つ(トークンまたはXRP)と一致する必要があります。 |
|
||||
| `Amount2` | [通貨額][] | Amount | いいえ | AMMに追加する別の資産の量を指定します。存在する場合、これはAMMのプール内の他の資産と一致する必要があり、`Amount`と同じ資産にすることはできません。 |
|
||||
| `EPrice` | [通貨額][] | Amount | いいえ | 受け取った各LPトークンに支払う、預け入れ資産の最大有効価格です。 |
|
||||
| `LPTokenOut` | [通貨額][] | Amount | いいえ | AMMのLPトークンの購入数量。 |
|
||||
|
||||
|
||||
### AMMDepositモード
|
||||
|
||||
このトランザクションには5つのモードがあり、どのフラグを指定するかで定義されます。それぞれのモードは、特定のフィールドの組み合わせを必要とし、次の2つのカテゴリーに分類されます。
|
||||
|
||||
- **ダブルアセット入金**: AMMのプールにある両方(2つ)の資産を、既存の資産の残高に比例して預けます。この預け入れは手数料の対象外です。
|
||||
- **シングルアセット入金**, AMMの2つの資産のうち1つだけを預けます。AMMは、この預け入れによってプール内の資産残高がどれだけ変化したかによって、対価として支払われるLPトークンから差し引く手数料を設定します。
|
||||
|
||||
以下の項目の組み合わせは、**ダブルアセット入金**について示しています。
|
||||
|
||||
| フラグ名 | フラグ値 | 指定フィールド | 意味 |
|
||||
|--------------|--------------|------------------------|---------|
|
||||
| `tfLPToken` | `0x00010000` | `LPTokenOut`のみ | 指定された量のLPトークンを受け取るように計算された金額の、このAMMの両資産を預けます。預ける金額は、AMMの保有する2つの資産の割合と等しくなります。 |
|
||||
| `tfTwoAsset` | `0x00100000` | `Amount`と`Amount2` | このAMMの両資産を指定された金額まで預けます。実際に預ける金額は、AMMがすでに保有している資産と同じ割合を維持する必要があるため、どちらか一方の預け入れ金額が指定金額より少なくてもかまいません。引き換えに得られるLPトークンの金額は、預けた金額の合計に基づきます。 |
|
||||
|
||||
以下の項目の組み合わせは、**シングルアセット入金**について示しています。
|
||||
|
||||
| フラグ名 | フラグ値 | 指定フィールド | 意味 |
|
||||
|---------------------|--------------|------------------------|---------|
|
||||
| `tfSingleAsset` | `0x00080000` | `Amount`のみ | 指定の資産を指定の量だけ預け、その結果得られたプールのシェアに応じた量のLPトークンを受け取ります。(手数料を差し引いた金額) |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | `Amount`と`LPTokenOut` | 1つの資産を指定された上限額まで預け、対価として指定金額分のLPトークンを受け取ります。(手数料を差し引いた金額) |
|
||||
| `tfLimitLPToken` | `0x00400000` | `Amount`と`EPrice` | 1つの資産を指定された金額まで預けますが、LPトークン1つにつき指定された有効価格(手数料差引後)を超えて預けることはありません。 |
|
||||
|
||||
これ以外のフィールドとフラグの組み合わせは無効です。
|
||||
|
||||
|
||||
### シングルアセット入金手数料
|
||||
|
||||
シングルアセット入金の手数料は、AMMを使って預け入れ金額の一部を他の資産と交換し、ダブルアセット入金を行った場合と同じになるように計算されます。AMMの取引手数料は、取引に必要な金額には適用されますが、残りの預け入れ金額には適用されません。 _例えば、AMMの資産プールがUSDとEURで完全に均等に分割されている場合、100USDを預けようとすると、受け取るLPトークンの量は、50EUR+50USDを預けた場合よりもわずかに少なくなります。_
|
||||
|
||||
ダブルアセット入金の場合、LPトークンを受け取る数は、以下の計算式で算出できます。
|
||||
|
||||
{{ include_svg("img/amm-single-asset-deposit-formula.svg", "L = T × ( (( 1 + (B - (F × (1 - W) × B)) ÷ P)^W) - 1)") }}
|
||||
<!-- TODO: improve graphic -->
|
||||
|
||||
- `L`: 受け取るLPトークンの量
|
||||
- `T`: 預け入れ前のLPトークンの残高合計
|
||||
- `B`: 預け入れ資産の額
|
||||
- `F`: 取引手数料
|
||||
- `W`: プール内の預金資産の重みです。これはすべてのAMMプールで0.5と定義されています(50/50の分割を意味します)ので、Wによる累乗は平方根を取ることと同一です。
|
||||
- `P`: 預け入れ前のプール内の預金資産の合計額
|
||||
|
||||
### AMMDepositフラグ
|
||||
|
||||
AMMDepositタイプのトランザクションは、以下のように[`Flags`フィールド](transaction-common-fields.html#flagsフィールド)の値を追加でサポートしています。
|
||||
|
||||
| フラグ名 | 16進数値 | 10進数値 | 説明 |
|
||||
|:--------------------|:-------------|:--------------|:----------------------|
|
||||
| `tfLPToken` | `0x00010000` | 65536 | ダブルアセット入金を行い、指定された額のLPトークンを受け取ります。 |
|
||||
| `tfSingleAsset` | `0x00080000` | 524288 | 預け入れる資産を指定して、シングルアセット入金を行います。 |
|
||||
| `tfTwoAsset` | `0x00100000` | 1048576 | 両資産を指定金額で預けるダブルアセット入金を行います。 |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | 2097152 | シングルアセット入金を行い、指定された額のLPトークンを受け取ります。 |
|
||||
| `tfLimitLPToken` | `0x00400000` | 4194304 | 有効価格を指定して、シングルアセット入金を行います。 |
|
||||
|
||||
これらのフラグのうちの **1つのみ** と、任意の[グローバルフラグ](transaction-common-fields.html#グローバルフラグ)を指定する必要があります。
|
||||
|
||||
|
||||
## エラーケース
|
||||
|
||||
すべてのトランザクションで発生する可能性のあるエラーに加えて、{{currentpage.name}}トランザクションでは、次の[トランザクション結果コード](transaction-results.html)が発生する可能性があります。
|
||||
|
||||
|
||||
| エラーコード | 説明 |
|
||||
|:------------------------|:---------------------------------------------|
|
||||
| `temBAD_AMM_OPTIONS` | トランザクションで無効なフィールドの組み合わせが指定されました。詳細は、[AMMDepositモード](#ammdepositモード)を参照してください。 |
|
||||
| `tecFROZEN` | トランザクションは[凍結](freezes.html)されているトークンを預けようとしました。 |
|
||||
| `tecAMM_BALANCE` | AMMが預け入れを行うのに十分な量の資産を保有していない(たとえば、シングルアセット入金に必要な残高を保有していない)、または送信者が指定されたトークンを十分に保有していない場合など。 |
|
||||
| `temBAD_AMM_TOKENS` | トランザクションでLPトークンが正しく指定されています。例えば、`issuer`がAMMのAccountRootアドレスでない、`currency`がこのAMMのLPトークンの通貨コードでない、またはトランザクションがAssetフィールドのいずれかにこのAMMのLPトークンを指定した、など。 |
|
||||
| `tecAMM_FAILED_DEPOSIT` | 預け入れの条件が成立しませんでした。例えば、`EPrice`フィールドに指定された実効価格が低すぎる場合など。 |
|
||||
| `tecAMM_INVALID_TOKENS` | このトークンペアのAMMが存在しないか、計算の結果、預け入れ金額がゼロに丸められました。 |
|
||||
| `tecINSUF_RESERVE_LINE` | このトランザクションの送信者は、この処理による[準備金要件](reserves.html)の増加の対象であり、LPトークンを保持するための新しいトラストラインが必要で、そのための追加の所有者準備金分のXRPを保有していないためと思われます。 |
|
||||
| `tecNO_AUTH` | 送信者は、預け入れ資産のいずれかを保有する権限を持っ ていません。 |
|
||||
| `tecNO_LINE` | 送信者が預け入れ資産のうち1つに対し、トラストラインを保有していません。 |
|
||||
| `tecUNFUNDED_AMM` | 送信者の残高が、指定された預け入れを行うのに十分な量ではありません。 |
|
||||
| `terNO_ACCOUNT` | リクエストで参照されたいずれかのアカウントが存在しません。 |
|
||||
| `terNO_AMM` | このトランザクションの資産ペアの自動マーケットメーカーインスタンスが存在しません。 |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,137 +0,0 @@
|
||||
---
|
||||
html: ammdeposit.html
|
||||
parent: transaction-types.html
|
||||
blurb: Deposit funds into an Automated Market Maker in exchange for LPTokens.
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMDeposit
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMDeposit.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
Deposit funds into an [Automated Market Maker](automated-market-makers.html) (AMM) instance and receive the AMM's liquidity provider tokens (_LP Tokens_) in exchange. You can deposit one or both of the assets in the AMM's pool.
|
||||
|
||||
If successful, this transaction creates a [trust line](trust-lines-and-issuing.html) to the AMM Account (limit 0) to hold the LP Tokens.
|
||||
|
||||
## Example {{currentpage.name}} JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Amount" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value" : "2.5"
|
||||
},
|
||||
"Amount2" : "30000000",
|
||||
"Asset" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 1048576,
|
||||
"Sequence" : 7,
|
||||
"TransactionType" : "AMMDeposit"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:--------------|:--------------------|:------------------|:----------|:------------|
|
||||
| `Asset` | Object | STIssue | Yes | The definition for one of the assets in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `Asset2` | Object | STIssue | Yes | The definition for the other asset in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `Amount` | [Currency Amount][] | Amount | No | The amount of one asset to deposit to the AMM. If present, this must match the type of one of the assets (tokens or XRP) in the AMM's pool. |
|
||||
| `Amount2` | [Currency Amount][] | Amount | No | The amount of another asset to add to the AMM. If present, this must match the type of the other asset in the AMM's pool and cannot be the same asset as `Amount`. |
|
||||
| `EPrice` | [Currency Amount][] | Amount | No | The maximum effective price, in the deposit asset, to pay for each LP Token received. |
|
||||
| `LPTokenOut` | [Currency Amount][] | Amount | No | How many of the AMM's LP Tokens to buy. |
|
||||
|
||||
|
||||
### AMMDeposit Modes
|
||||
|
||||
This transaction has five modes, defined by which flag you specify. Each mode expects a specific combination of fields. The modes fall into two categories:
|
||||
|
||||
- **Double-asset deposits**, in which you provide both assets in the AMM's pool, proportional to the balance of the assets already there. These deposits are not subject to a fee.
|
||||
- **Single-asset deposits**, in which you provide only one of the AMM's two assets. The AMM charges a fee, debited from the LP Tokens paid out, based on how much your deposit shifts the balance of assets in the pool.
|
||||
|
||||
The following combinations of fields indicate a **double-asset deposit**:
|
||||
|
||||
| Flag Name | Flag Value | Fields Specified | Meaning |
|
||||
|--------------|--------------|------------------------|---------|
|
||||
| `tfLPToken` | `0x00010000` | `LPTokenOut` only | Deposit both of this AMM's assets, in amounts calculated so that you receive the specified amount of LP Tokens in return. The amounts deposited maintain the relative proportions of the two assets the AMM already holds. |
|
||||
| `tfTwoAsset` | `0x00100000` | `Amount` and `Amount2` | Deposit both of this AMM's assets, up to the specified amounts. The actual amounts deposited must maintain the same balance of assets as the AMM already holds, so the amount of either one deposited MAY be less than specified. The amount of LP Tokens you get in return is based on the total value deposited. |
|
||||
|
||||
The following combinations of fields indicate a **single asset deposit**:
|
||||
|
||||
| Flag Name | Flag Value | Fields Specified | Meaning |
|
||||
|---------------------|--------------|----------------------------|---------|
|
||||
| `tfSingleAsset` | `0x00080000` | `Amount` only | Deposit exactly the specified amount of one asset, and receive an amount of LP Tokens based on the resulting share of the pool (minus fees). |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | `Amount` and `LPTokenOut` | Deposit up to the specified amount of one asset, so that you receive exactly the specified amount of LP Tokens in return (after fees). |
|
||||
| `tfLimitLPToken` | `0x00400000` | `Amount` and `EPrice` | Deposit up to the specified amount of one asset, but pay no more than the specified effective price per LP Token (after fees). |
|
||||
|
||||
Any other combination of these fields and flags is invalid.
|
||||
|
||||
|
||||
### Single Asset Deposit Fee
|
||||
|
||||
The fee for a single asset deposit is calculated to be the same as if you had used the AMM to trade part of the deposit amount for the other asset, then done a double-asset deposit. The AMM's trading fee applies to the amount you would need to trade for, but not to the rest of the deposit. _For example, if the AMM's asset pool is split perfectly evenly between USD and EUR, and you try to deposit 100 USD, the amount of LP Tokens you receive is slightly less than if you had deposited 50 EUR + 50 USD, because you pay the trading fee to convert some of your USD to an equal amount of EUR._
|
||||
|
||||
The formula for how many LP Tokens you receive for a double-asset deposit is:
|
||||
|
||||
{{ include_svg("img/amm-single-asset-deposit-formula.svg", "L = T × ( (( 1 + (B - (F × (1 - W) × B)) ÷ P)^W) - 1)") }}
|
||||
<!-- TODO: improve graphic -->
|
||||
|
||||
Where:
|
||||
|
||||
- `L` is the amount of LP Tokens returned
|
||||
- `T` is the total outstanding LP Tokens before the deposit
|
||||
- `B` is the amount of the asset being deposited
|
||||
- `F` is the trading fee, as a decimal
|
||||
- `W` is the weight of the deposit asset in the pool. This is defined as 0.5 for all AMM pools (meaning a 50/50 split), so exponentiation by W is equivalent to taking the square root.
|
||||
- `P` is the total amount of the deposit asset in the pool before the deposit
|
||||
|
||||
### AMMDeposit Flags
|
||||
|
||||
Transactions of the AMMDeposit type support additional values in the [`Flags` field](transaction-common-fields.html#flags-field), as follows:
|
||||
|
||||
| Flag Name | Hex Value | Decimal Value | Description |
|
||||
|:--------------------|:-------------|:--------------|:----------------------|
|
||||
| `tfLPToken` | `0x00010000` | 65536 | Perform a double-asset deposit and receive the specified amount of LP Tokens. |
|
||||
| `tfSingleAsset` | `0x00080000` | 524288 | Perform a single-asset deposit with a specified amount of the asset to deposit. |
|
||||
| `tfTwoAsset` | `0x00100000` | 1048576 | Perform a double-asset deposit with specified amounts of both assets. |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | 2097152 | Perform a single-asset deposit and receive the specified amount of LP Tokens. |
|
||||
| `tfLimitLPToken` | `0x00400000` | 4194304 | Perform a single-asset deposit with a specified effective price. |
|
||||
|
||||
You must specify **exactly one** of these flags, plus any [global flags](transaction-common-fields.html#global-flags).
|
||||
|
||||
|
||||
## Error Cases
|
||||
|
||||
Besides errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):
|
||||
|
||||
| Error Code | Description |
|
||||
|:------------------------|:---------------------------------------------|
|
||||
| `temBAD_AMM_OPTIONS` | The transaction specified an invalid combination of fields. See [AMMDeposit Modes](#ammdeposit-modes). |
|
||||
| `tecFROZEN` | The transaction tried to deposit a [frozen](freezes.html) token. |
|
||||
| `tecAMM_BALANCE` | The AMM does not have enough of one of the assets to accept the deposit (for example, to satisfy the trade part of a single-asset deposit) or the sender does not have enough of a given token. |
|
||||
| `temBAD_AMM_TOKENS` | The transaction specified the LP Tokens incorrectly; for example, the `issuer` is not the AMM's associated AccountRoot address or the `currency` is not the currency code for this AMM's LP Tokens, or the transaction specified this AMM's LP Tokens in one of the asset fields. |
|
||||
| `tecAMM_FAILED_DEPOSIT` | The conditions on the deposit could not be satisfied; for example, the requested effective price in the `EPrice` field is too low. |
|
||||
| `tecAMM_INVALID_TOKENS` | The AMM for this token pair does not exist, or one of the calculations resulted in a deposit amount rounding to zero. |
|
||||
| `tecINSUF_RESERVE_LINE` | The sender of this transaction does meet the increased [reserve requirement](reserves.html) of processing this transaction, probably because they need a new trust line to hold the LP Tokens, and they don't have enough XRP to meet the additional owner reserve for a new trust line. |
|
||||
| `tecNO_AUTH` | The sender is not authorized to hold one of the deposit assets. |
|
||||
| `tecNO_LINE` | The sender does not have a trust line for one of the deposit assets. |
|
||||
| `tecUNFUNDED_AMM` | The sender does not have a high enough balance to make the specified deposit. |
|
||||
| `terNO_ACCOUNT` | An account specified in the request does not exist. |
|
||||
| `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
html: ammvote.html
|
||||
parent: transaction-types.html
|
||||
blurb: 自動マーケットメーカーインスタンスの取引手数料を投票する。
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMVote
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMVote.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
[自動マーケットメーカー](automated-market-makers.html)インスタンスの取引手数料を投票します。最大8つのアカウントが、保有するAMMのLPトークンの量に比例して投票することができます。各新規投票では、投票の加重平均に基づいてAMMの取引手数料が再計算されます。
|
||||
|
||||
## {{currentpage.name}} JSONの例
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Asset" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 2147483648,
|
||||
"Sequence" : 8,
|
||||
"TradingFee" : 600,
|
||||
"TransactionType" : "AMMVote"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.ja.md' %}
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:-------------|:----------|:-----------|:-----|:------------|
|
||||
| `Asset` | Object | STIssue | はい | AMMのプールにある資産の一つを定義します。JSONでは、`currency` と `issuer` フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。 |
|
||||
| `Asset2` | Object | STIssue | はい | AMMのプールにあるもう一つの資産を定義します。JSONでは、`currency` と `issuer` フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。|
|
||||
| `TradingFee` | Number | UInt16 | はい | 投票に必要な手数料を100000の1の単位で指定します。最大値は1000で、1%の手数料を表します。 |
|
||||
|
||||
## エラーケース
|
||||
|
||||
すべてのトランザクションで発生する可能性のあるエラーに加えて、{{currentpage.name}}トランザクションでは、次の[トランザクション結果コード](transaction-results.html)が発生する可能性があります。
|
||||
|
||||
| エラーコード | 説明 |
|
||||
|:------------------------|:---------------------------------------------|
|
||||
| `tecAMM_INVALID_TOKENS` | 送信者は、このAMMのLPトークンを保有していないため、投票することができません。 |
|
||||
| `tecAMM_FAILED_VOTE` | このトランザクションの送信者よりも多くのLPトークンを保有しているアカウントからの投票が既に8件存在しています。 |
|
||||
| `terNO_ACCOUNT` | このトランザクションで指定されたアカウントが存在しません。 |
|
||||
| `temBAD_FEE` | このトランザクションの`TradingFee`は正しくありません。 |
|
||||
| `terNO_AMM` | このトランザクションの資産ペアの自動マーケットメーカー インスタンスが存在しません。 |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,61 +0,0 @@
|
||||
---
|
||||
html: ammvote.html
|
||||
parent: transaction-types.html
|
||||
blurb: Vote on the trading fee for an Automated Market Maker instance.
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMVote
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMVote.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
Vote on the trading fee for an [Automated Market Maker](automated-market-makers.html) instance. Up to 8 accounts can vote in proportion to the amount of the AMM's LP Tokens they hold. Each new vote re-calculates the AMM's trading fee based on a weighted average of the votes.
|
||||
|
||||
## Example {{currentpage.name}} JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Asset" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 2147483648,
|
||||
"Sequence" : 8,
|
||||
"TradingFee" : 600,
|
||||
"TransactionType" : "AMMVote"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:-------------|:----------|:------------------|:----------|:------------|
|
||||
| `Asset` | Object | STIssue | Yes | The definition for one of the assets in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `Asset2` | Object | STIssue | Yes | The definition for the other asset in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `TradingFee` | Number | UInt16 | Yes | The proposed fee to vote for, in units of 1/100,000; a value of 1 is equivalent to 0.001%. The maximum value is 1000, indicating a 1% fee. |
|
||||
|
||||
## Error Cases
|
||||
|
||||
Besides errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):
|
||||
|
||||
| Error Code | Description |
|
||||
|:------------------------|:---------------------------------------------|
|
||||
| `tecAMM_INVALID_TOKENS` | The sender cannot vote because they do not hold any of this AMM's LP Tokens. |
|
||||
| `tecAMM_FAILED_VOTE` | There are already 8 votes from accounts that hold more LP Tokens than the sender of this transaction. |
|
||||
| `terNO_ACCOUNT` | An account specified in this transaction does not exist. |
|
||||
| `temBAD_FEE` | The `TradingFee` from this transaction is not valid. |
|
||||
| `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,125 +0,0 @@
|
||||
---
|
||||
html: ammwithdraw.html
|
||||
parent: transaction-types.html
|
||||
blurb: LPTokenを自動マーケットメーカーに返却し、プールが保有する資産の一部と引き換える。
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMWithdraw
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMWithdraw.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.ja.md' %}
|
||||
|
||||
AMMの流動性プロバイダトークン(LPトークン)を返すことで、[自動マーケットメーカー](automated-market-makers.html)(AMM)インスタンスから資産を引き出します。
|
||||
|
||||
## {{currentpage.name}} JSONの例
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Amount" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value" : "5"
|
||||
},
|
||||
"Amount2" : "50000000",
|
||||
"Asset" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 1048576,
|
||||
"Sequence" : 10,
|
||||
"TransactionType" : "AMMWithdraw"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
|
||||
| フィールド | JSONの型 | [内部の型][] | 必須? | 説明 |
|
||||
|:-------------|:-----------|:-----------|:------|:------------|
|
||||
| `Asset` | オブジェクト | STIssue | はい | AMMのプールにある資産の一つを定義します。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトになります(XRPの場合は`issuer`を省略します)。 |
|
||||
| `Asset2` | オブジェクト | STIssue | はい | AMMのプールにあるもう一つの資産を定義します。JSONでは、`currency`と`issuer`フィールドを持つオブジェクトです(XRPの場合は`issuer`を省略)。|
|
||||
| `Amount` | [通貨額][] | Amount | いいえ | AMMから引き出す1つの資産の量。これは、AMMのプールにある資産の1つ(トークンまたはXRP)と一致する必要があります。 |
|
||||
| `Amount2` | [通貨額][] | Amount | いいえ | AMMから引き出す他の資産の量。存在する場合、これはAMMのプール内の他の資産と一致する必要があり、`Amount`と同じにすることはできません。 |
|
||||
| `EPrice` | [通貨額][] | Amount | いいえ | 引き出しに必要な、資産の1単位あたりに支払う最低有効価格(LPトークンの返却単位)。 |
|
||||
| `LPTokenIn` | [通貨額][] | Amount | いいえ | AMMのLPトークンの引き替え数。 |
|
||||
|
||||
**注記:** ダブルアセット出金の場合、`Asset1`と`Amount1`または`Amount2`が対応していれば、`Asset2`はもう一方に対応することが可能です。しかし、両者を一致させることをお勧めします(つまり、`Amount2`は`Asset2`で定義されたアセットの金額です)。その方が混乱を招きにくくなります。
|
||||
|
||||
### AMMWithdrawモード
|
||||
|
||||
このトランザクションには、指定するフラグによって、いくつかのモードがあります。それぞれのモードは、特定のフィールドの組み合わせを必要とし、以下の2つのカテゴリーに分類されます。
|
||||
|
||||
- **ダブルアセット出金**: AMMのプールから両方の資産を、その残高と同じ割合で受け取ります。これらの引き出しには手数料はかかりません。
|
||||
- **シングルアセット出金**: AMMのプールから1つの資産を受け取ります。AMMは、あなたの引き出しによってプール内の資産残高がどれだけ変動するかによって手数料を設定します。引き出しのモードによって、手数料の額は、支払われたLPトークンの量から差し引かれるか、引き出される資産の量から差し引かれるか決まります。
|
||||
|
||||
以下の項目の組み合わせは、**ダブルアセット出金**について示しています。
|
||||
|
||||
| フラグ名 | フラグ値 | 指定フィール | 意味 |
|
||||
|-----------------|--------------|---------------- ----|---------|
|
||||
| `tfLPToken` | `0x00010000` | `LPTokenIn`のみ | 指定された量のLPトークンを返還し、AMMのプールから、LPトークンの発行総数に対する返還されたトークンの割合に基づく金額の両資産を受 け取ります。 |
|
||||
| `tfWithdrawAll` | `0x00020000` | なし | LPトークンを _全て_ 返還し、AMMのプールにある両資産を最大限受け取ります。 |
|
||||
| `tfTwoAsset` | `0x00100000` | `Amount`と`Amount2` | AMMの資産を、指定した金額を上限として、両方とも引き出します。実際に受け取る金額は、AMMのプールの資産残高の割合と同じになります。 |
|
||||
|
||||
以下の項目の組み合わせは、**シングルアセット出金**について示しています。
|
||||
|
||||
| フラグ名 | フラグ値 | 指定フィールド | 意味 |
|
||||
|-------------------------|--------------|-----------------------|---------|
|
||||
| `tfSingleAsset` | `0x00080000` | `Amount`のみ | LPトークンを必要な数だけ返還し、1つの資産を指定した量だけ出金する。 |
|
||||
| `tfOneAssetWithdrawAll` | `0x00040000` | `Amount`のみ | LPトークンを全て返還することで、1つの資産を指定した金額以上引き出します。指定された金額以上を受け取ることができない場合は失敗します。指定する金額は0でもかまいません。この場合、少しでも正の金額を引き出せば成功します。 |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | `Amount`と`LPTokenIn` | 指定した量のLPトークンを返還することで、1つの資産を指定した量まで引き出します。 |
|
||||
| `tfLimitLPToken` | `0x00400000` | `Amount`と`EPrice` | 指定した1つの資産の量を上限として出金しますが、受け取る資産の一単位あたりのLPトークンで指定した有効価格より高い金額を支払うことはありません。 |
|
||||
|
||||
これら以外のフィールドとフラグの組み合わせは無効です。
|
||||
|
||||
### シングルアセット出金手数料
|
||||
|
||||
シングルアセット出金にかかる手数料は、ダブルアセット出金を行い、AMMを使用してもう一方の資産を全て引き出しにかかる資産と交換した場合と同じになるように計算されます。取引手数料は、取引に必要な金額に適用されますが、残りの引き出し分には適用されません。
|
||||
|
||||
<!-- TODO: add a formula and example calculation(s) of single-asset withdrawal fees -->
|
||||
|
||||
|
||||
### AMMWithdrawフラグ
|
||||
|
||||
AMMWithdrawタイプのトランザクションは、以下のように[`Flags`フィールド](transaction-common-fields.html#flagsフィールド)の値を追加でサポートしています。
|
||||
|
||||
| フラグ名 | 16進数値 | 10進数値 | 説明 |
|
||||
|:------------------------|:-------------|:--------------|:----------------------|
|
||||
| `tfLPToken` | `0x00010000` | 65536 | 指定された額のLPトークンを返還する、ダブルアセット出金を行います。 |
|
||||
| `tfWithdrawAll` | `0x00020000` | 131072 | LPトークンをすべて返還する、ダブルアセット出金を行います。 |
|
||||
| `tfOneAssetWithdrawAll` | `0x00040000` | 262144 | 全てのLPトークンを返還する、シングルアセット出金を行います。 |
|
||||
| `tfSingleAsset` | `0x00080000` | 524288 | 引き出す資産を指定して、シングルアセット出金を行います。|
|
||||
| `tfTwoAsset` | `0x00100000` | 1048576 | 両資産の金額を指定して、ダブルアセット出金を行います。 |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | 2097152 | シングルアセット出金を行い、指定された額のLPトークンを受け取ります。 |
|
||||
| `tfLimitLPToken` | `0x00400000` | 4194304 | 有効価格を指定して、シングルアセット出金を行います。 |
|
||||
|
||||
これらのフラグのうちの **1つのみ** と、任意の[グローバルフラグ](transaction-common-fields.html#グローバルフラグ)を指定する必要があります。
|
||||
|
||||
|
||||
## エラーケース
|
||||
|
||||
すべてのトランザクションで発生する可能性のあるエラーに加えて、{{currentpage.name}}トランザクションでは、次の[トランザクション結果コード](transaction-results.html)が発生する可能性があります。
|
||||
|
||||
| エラーコード | 説明 |
|
||||
|:-------------------------|:---------------------------------------------|
|
||||
| `tecFROZEN` | トランザクションは[凍結](freezes.html)されたトークンを引き出そうとしました。 |
|
||||
| `tecAMM_BALANCE` | トランザクションによって、プールから1つの資産をすべて引き出そうとしている、もしくは`tfWithdrawAll`の場合に端数処理によって0以外の金額が残ってしまっています。 |
|
||||
| `tecAMM_FAILED_WITHDRAW` | 例えば、`EPrice`フィールドに指定された有効価格が低過ぎる場合など、引き出しに関する条件が成立しませんでした。 |
|
||||
| `tecAMM_INVALID_TOKENS` | トークンペアのAMMが存在しないか、計算の結果、引き出し額がゼロに丸められました。 |
|
||||
| `tecINSUF_RESERVE_LINE` | トランザクションの送信者は、このトランザクションを処理するための[準備金要件](reserves.html)の増加に対応できません。おそらく、引き出される資産の1つを保持するために少なくとも1つの新しいトラストラインが必要ですが、新しいトラストラインのための追加の所有者準備金分のXRPを持っていないためでしょう。 |
|
||||
| `tecNO_AUTH` | 送信者は、引き出し資産のいずれかを保有する権限を有していません。 |
|
||||
| `temBAD_AMM_OPTIONS` | トランザクションで無効なフィールドの組み合わせが指定されました。[AMMWithdrawモード](#ammwithdrawモード)を参照してください。 |
|
||||
| `temBAD_AMM_TOKENS` | 例えば、`issuer`がAMMの関連するAccountRootアドレスでない、`currency`がこのAMMのLPトークンの通貨コードでない、またはトランザクションがこのAMMのLPトークンをAssetフィールドの1つに指定した、などです。 |
|
||||
| `terNO_AMM` | トランザクションで指定した資産ペアの自動マーケットメーカーインスタンスが存在しません。 |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
@@ -1,125 +0,0 @@
|
||||
---
|
||||
html: ammwithdraw.html
|
||||
parent: transaction-types.html
|
||||
blurb: Return LPTokens into an Automated Market Maker in exchange for a share of the assets the pool holds.
|
||||
labels:
|
||||
- AMM
|
||||
status: not_enabled
|
||||
---
|
||||
# AMMWithdraw
|
||||
[[Source]](https://github.com/gregtatcam/rippled/blob/amm-core-functionality/src/ripple/app/tx/impl/AMMWithdraw.cpp "Source")
|
||||
<!-- TODO: Update source link to merged version when available -->
|
||||
|
||||
{% include '_snippets/amm-disclaimer.md' %}
|
||||
|
||||
Withdraw assets from an [Automated Market Maker](automated-market-makers.html) (AMM) instance by returning the AMM's liquidity provider tokens (LP Tokens).
|
||||
|
||||
## Example {{currentpage.name}} JSON
|
||||
|
||||
```json
|
||||
{
|
||||
"Account" : "rJVUeRqDFNs2xqA7ncVE6ZoAhPUoaJJSQm",
|
||||
"Amount" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd",
|
||||
"value" : "5"
|
||||
},
|
||||
"Amount2" : "50000000",
|
||||
"Asset" : {
|
||||
"currency" : "TST",
|
||||
"issuer" : "rP9jPyP5kyvFRb6ZiRghAGw5u8SGAmU4bd"
|
||||
},
|
||||
"Asset2" : {
|
||||
"currency" : "XRP"
|
||||
},
|
||||
"Fee" : "10",
|
||||
"Flags" : 1048576,
|
||||
"Sequence" : 10,
|
||||
"TransactionType" : "AMMWithdraw"
|
||||
}
|
||||
```
|
||||
|
||||
{% include '_snippets/tx-fields-intro.md' %}
|
||||
|
||||
| Field | JSON Type | [Internal Type][] | Required? | Description |
|
||||
|:-------------|:--------------------|:------------------|:----------|:------------|
|
||||
| `Asset` | Object | STIssue | Yes | The definition for one of the assets in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `Asset2` | Object | STIssue | Yes | The definition for the other asset in the AMM's pool. In JSON, this is an object with `currency` and `issuer` fields (omit `issuer` for XRP). |
|
||||
| `Amount` | [Currency Amount][] | Amount | No | The amount of one asset to withdraw from the AMM. This must match the type of one of the assets (tokens or XRP) in the AMM's pool. |
|
||||
| `Amount2` | [Currency Amount][] | Amount | No | The amount of another asset to withdraw from the AMM. If present, this must match the type of the other asset in the AMM's pool and cannot be the same type as `Amount`. |
|
||||
| `EPrice` | [Currency Amount][] | Amount | No | The minimum effective price, in LP Token returned, to pay per unit of the asset to withdraw. |
|
||||
| `LPTokenIn` | [Currency Amount][] | Amount | No | How many of the AMM's LP Tokens to redeem. |
|
||||
|
||||
**Note:** For a double-asset withdrawal, it is possible for `Asset` to correspond to _either_ `Amount` or `Amount2` as long as `Asset2` corresponds to the other one. It is recommended to match them (that is, `Amount2` is an amount of the asset defined in `Asset2`) because it is less confusing that way.
|
||||
|
||||
### AMMWithdraw Modes
|
||||
|
||||
This transaction has several modes, depending on which flags you specify. Each mode expects a specific combination of fields. The modes fall into two categories:
|
||||
|
||||
- **Double-asset withdrawals**, in which you receive both assets from the AMM's pool in proportions that match their balances there. These withdrawals are not subject to a fee.
|
||||
- **Single-asset withdrawals**, in which you receive one asset from the AMM's pool. The AMM charges a fee based on how much your deposit shifts the balance of assets in the pool. Depending on the withdraw mode, the amount of the fee can be added to the amount of LP Tokens paid in, or debited from the amount of the asset paid out.
|
||||
|
||||
The following combinations of fields indicate a **double-asset withdrawal**:
|
||||
|
||||
| Flag Name(s) | Flag Value | Fields Specified | Meaning |
|
||||
|-----------------|--------------|------------------------|---------|
|
||||
| `tfLPToken` | `0x00010000` | `LPTokenIn` only | Return the specified amount of LP Tokens and receive both assets from the AMM's pool in amounts based on the returned LP Tokens' share of the total LP Tokens issued. |
|
||||
| `tfWithdrawAll` | `0x00020000` | No Fields | Return _all_ of your LP Tokens and receive as much as you can of both assets in the AMM's pool. |
|
||||
| `tfTwoAsset` | `0x00100000` | `Amount` and `Amount2` | Withdraw both of this AMM's assets, in up to the specified amounts. The actual amounts received maintains the balance of assets in the AMM's pool. |
|
||||
|
||||
The following combinations of fields indicate a **single asset withdrawal**:
|
||||
|
||||
| Flag Name(s) | Flag Value | Fields Specified | Meaning |
|
||||
|-------------------------|--------------|--------------------------|---------|
|
||||
| `tfSingleAsset` | `0x00080000` | `Amount` only | Withdraw exactly the specified amount of one asset, by returning as many LP Tokens as necessary. |
|
||||
| `tfOneAssetWithdrawAll` | `0x00040000` | `Amount` only | Withdraw at least the specified amount of one asset, by returning _all_ of your LP Tokens. Fails if you can't receive at least the specified amount. The specified amount can be 0, meaning the transaction succeeds if it withdraws any positive amount. |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | `Amount` and `LPTokenIn` | Withdraw up to the specified amount of one asset, by returning up to the specified amount of LP Tokens. |
|
||||
| `tfLimitLPToken` | `0x00400000` | `Amount` and `EPrice` | Withdraw up to the specified amount of one asset, but pay no more than the specified effective price in LP Tokens per unit of the asset received. |
|
||||
|
||||
Any other combination of these fields is invalid.
|
||||
|
||||
### Single Asset Withdrawal Fee
|
||||
|
||||
The fee for a single asset withdrawal is calculated to be the same as if you had done a double-asset withdrawal and then used the AMM to trade all of the other asset for the one you are withdrawing. The trading fee applies to the amount you would need to trade for, but not to the rest of the withdrawal.
|
||||
|
||||
<!-- TODO: add a formula and example calculation(s) of single-asset withdrawal fees -->
|
||||
|
||||
|
||||
### AMMWithdraw Flags
|
||||
|
||||
Transactions of the AMMWithdraw type support additional values in the [`Flags` field](transaction-common-fields.html#flags-field), as follows:
|
||||
|
||||
| Flag Name | Hex Value | Decimal Value | Description |
|
||||
|:------------------------|:-------------|:--------------|:----------------------|
|
||||
| `tfLPToken` | `0x00010000` | 65536 | Perform a double-asset withdrawal and receive the specified amount of LP Tokens. |
|
||||
| `tfWithdrawAll` | `0x00020000` | 131072 | Perform a double-asset withdrawal returning all your LP Tokens. |
|
||||
| `tfOneAssetWithdrawAll` | `0x00040000` | 262144 | Perform a single-asset withdrawal returning all of your LP Tokens. |
|
||||
| `tfSingleAsset` | `0x00080000` | 524288 | Perform a single-asset withdrawal with a specified amount of the asset to withdrawal. |
|
||||
| `tfTwoAsset` | `0x00100000` | 1048576 | Perform a double-asset withdrawal with specified amounts of both assets. |
|
||||
| `tfOneAssetLPToken` | `0x00200000` | 2097152 | Perform a single-asset withdrawal and receive the specified amount of LP Tokens. |
|
||||
| `tfLimitLPToken` | `0x00400000` | 4194304 | Perform a single-asset withdrawal with a specified effective price. |
|
||||
|
||||
You must specify **exactly one** of these flags, plus any [global flags](transaction-common-fields.html#global-flags).
|
||||
|
||||
|
||||
## Error Cases
|
||||
|
||||
Besides errors that can occur for all transactions, {{currentpage.name}} transactions can result in the following [transaction result codes](transaction-results.html):
|
||||
|
||||
| Error Code | Description |
|
||||
|:-------------------------|:---------------------------------------------|
|
||||
| `tecFROZEN` | The transaction tried to deposit a [frozen](freezes.html) token. |
|
||||
| `tecAMM_BALANCE` | The transaction would withdraw all of one asset from the pool, or rounding would cause a "withdraw all" to leave a nonzero amount behind. |
|
||||
| `tecAMM_FAILED_WITHDRAW` | The conditions on the withdrawal could not be satisfied; for example, the requested effective price in the `EPrice` field is too low. |
|
||||
| `tecAMM_INVALID_TOKENS` | The AMM for this token pair does not exist, or one of the calculations resulted in a withdrawal amount rounding to zero. |
|
||||
| `tecINSUF_RESERVE_LINE` | The sender of this transaction does not meet the increased [reserve requirement](reserves.html) of processing this transaction, probably because they need at least one new trust line to hold one of the assets to be withdrawn, and they don't have enough XRP to meet the additional owner reserve for a new trust line. |
|
||||
| `tecNO_AUTH` | The sender is not authorized to hold one of the deposit assets. |
|
||||
| `temBAD_AMM_OPTIONS` | The transaction specified an invalid combination of fields. See [AMMWithdraw Modes](#ammwithdraw-modes). |
|
||||
| `temBAD_AMM_TOKENS` | The transaction specified the LP Tokens incorrectly; for example, the `issuer` is not the AMM's associated AccountRoot address or the `currency` is not the currency code for this AMM's LP Tokens, or the transaction specified this AMM's LP Tokens in one of the asset fields. |
|
||||
| `terNO_AMM` | The Automated Market Maker instance for the asset pair in this transaction does not exist. |
|
||||
|
||||
|
||||
<!--{# common link defs #}-->
|
||||
{% include '_snippets/rippled-api-links.md' %}
|
||||
{% include '_snippets/tx-type-links.md' %}
|
||||
{% include '_snippets/rippled_versions.md' %}
|
||||
Reference in New Issue
Block a user