Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add spec for AMMClawback transaction #3

Merged
merged 2 commits into from
Jul 31, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
62 changes: 61 additions & 1 deletion XLS-0074d-amm-clawback/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -62,5 +62,65 @@ Suppose an issuer has enabled clawback by setting the `lsfAllowTrustLineClawback
This change allows for the creation of AMM pools with clawback-enabled issuers while introducing a new transaction type (`AMMClawback`) for issuers to clawback assets from AMM accounts.


#### 2.2.2. New transaction to claw back from AMM pools
#### 2.2.2. New transaction to claw back from AMM pools
This proposal introduces a new transaction type `AMMClawback` to allow asset issuers to claw back their assets from the AMM pool.

Issuers can only claw back issued tokens in the AMM pool only if the `lsfAllowTrustLineClawback` flag is enabled. Attempting to do so without this flag set will result in an error code `tecNO_PERMISSION`.

By designating the AMM account and holder account, this transaction will:
- Claw back all LPTokens held by the specified holder account that are associated with the issuer from the specified AMM account.
- Initiate a two-asset withdrawal from the AMM account, resulting in:
- The issuer's asset being returned to the issuer's account.
- The non-issuer asset being transferred back to the holder's account

##### 2.2.2.1. Fields for AMMClawback transaction

| Field Name | Required? | JSON Type | Internal Type |
|---------------------|:----------------:|:-------------:|:-----------------:|
| `TransactionType` |:heavy_check_mark:|`string` | `UINT16` |

`TransactionType` specifies the new transaction type `AMMClawback`. The integer value is 31. The recommended name is `ttAMMClawback`.

---

| Field Name | Required? | JSON Type | Internal Type |
|---------------------|:----------------:|:-------------:|:-----------------:|
| `Account` |:heavy_check_mark:|`string` | `ACCOUNT ID` |

`Account` designates the issuer of the asset being clawed back, and must match the account submitting the transaction.

---
| Field Name | Required? | JSON Type | Internal Type |
|---------------------|:----------------:|:-------------:|:-----------------:|
| `Holder` |:heavy_check_mark:|`string` | `ACCOUNT ID` |

`Holder` specifies the holder account of the LP Token to be clawed back.

---

| Field Name | Required? | JSON Type | Internal Type |
|---------------------|:----------------:|:-------------------:|:-----------------:|
| `AMMAccount` |:heavy_check_mark:|`string` | `ACCOUNT ID` |

`AMMAccount` specifies the AMM account from which the transaction will withdraw assets after clawing back `Holder`'s LPtokens.

---


##### 2.2.2.2. AMMClawback transaction example

```
{
"TransactionType": "AMMClawback",
"Account": "rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL",
"Holder": "rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B",
"AMMAccount": "rp2MaZMQDpgAHwWbADaQMrmf4AD5JsPQUR",
"Flags": 1,
"Fee": 10
}
```

- Upon execution, this transaction enables the issuer `rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL` to claw back up all LPTokens from holder `rvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59B` associated with AMM account `rp2MaZMQDpgAHwWbADaQMrmf4AD5JsPQUR`.
- The transaction will result in the withdrawal of two corresponding assets from the AMM account:
- The asset issued by the `Account` will be returned to the issuer.
- The other asset will be transferred back to the holder's wallet.