0073 XLS-73d: AMMClawback #212
Replies: 4 comments 18 replies
-
The way the new
Except it will (presumably) avoid rounding issues. Is this roughly an accurate description? Two questions:
|
Beta Was this translation helpful? Give feedback.
-
Is withdrawing already prohibited? If not, is there a reason why it is not being prohibited in this proposal? |
Beta Was this translation helpful? Give feedback.
-
For such pool, do we need to include a boolean allowClawback in amm_info's response? eg. account_info also includes allowTrustLineClawback |
Beta Was this translation helpful? Give feedback.
-
Is the clawback feature able to be used to prohibit an account that is not on a blacklist but just trying to single deposit Asset “A” which is an asset that anyone can acquire on the XRP Ledger (For example: XRP or RLUSD) into an AMM Pool paired to Asset “B” which is a regulated asset that they are not authorized to acquire or hold? In a hypothetical AMM Pool between RLUSD/TBILL a retail user could actually single deposit RLUSD and gain exposure to 50% of $TBILL which accrues the off-chain T-Bill Yield in its value gradually increasing. This makes the LP Token extremely powerful because It’s effectively a Super Stablecoin that is accruing multi Yield Streams that include the On-Chain AMM FEES, CAM revenue , Harvesting Volatility BUT with the addition of OFF-CHAIN Yield from short term US Treasury T-Bills on 50% of the value LP Tokens which is their ownership share. WoW 🤩These hypothetical LP Tokens are Ultra Pristine COLLATERAL. Perfect to use as collateral to borrower $RLUSD or $XRP creating borrow side demand in a secured DeFi Money Market Protocol on EVM Sidechain. I appreciate your response as it will help the community understand what the possible potential opportunities w we might see built out by Dapp Devs on EVM sidechain utilizing the AMM LP Tokens or in Future on XRPL once supporting amendments are passed and implemented. Thank You to all the brilliant minds who have been rigorously working continuously enhancing and maintaining the XRPL. Including all those individuals and businesses and universities and projects building on XRPL that run critical infrastructure including nodes, validators, and others. The community XRP Ledger Devs, Cryptographers, Mathematicians, Researchers, and Engineers that are executing on Ripple’s brilliant and very ambitious Roadmap for creating the foundation to support RWA Tokenization, Compliance, Identity Verification, and new enhancements to the core ledger or supporting the necessary Final question, can the current XLS-30d AMM SPEC be used with a Stablecoin like RLUSD and an Asset like TBILL tokens that are based on ERC-4626 Vault Contract that gradually but slowly increases the price from the Vault contract distribution of the Yield directly into the the TBILL Token market price, -Mickey B. Fresh “The DeFi Standard" |
Beta Was this translation helpful? Give feedback.
-
AMMClawback
Abstract
The AMMClawback amendment enables token issuers to regulate tokens and prevent misuse by blacklisted accounts. This proposal builds upon this foundation by introducing two key enhancements: improved interactions between frozen assets and AMM pools to prevent unauthorized transfers, and a new issuer-initiated clawback mechanism. This mechanism allows issuers to claw back tokens from wallets that have deposited into AMM pools, ensuring regulatory compliance. These enhancements will effectively prevent blacklisted token holders from transferring unauthorized funds, significantly benefiting use cases like stablecoins, where regulatory compliance is crucial.
1. Overview
This proposal introduces new improvements on how AMM interacts with frozen asset and clawback.
1.1. AMM and Frozen Asset
Tokens in frozen trustlines (either global or individual) are currently able to interact with AMM pools, which leaves opportunities for blacklisted accounts to maliciously move funds elsewhere through the AMM. To prevent these behaviors, this proposal introduces the following:
LPTokens
to another address if one of the tokens in the pool has been frozen (either individually or globally) by the token issuer1.2. AMM and Clawback
Currently, accounts that have enabled clawback cannot create AMM pools. This proposal introduces the following:
lsfAllowTrustLineClawback
. However, token issuers will not be allowed to claw back from the AMM account using theClawback
transaction.AMMClawback
transaction to allow token issuers to exclusively claw back from AMM pools that has one of their tokens, according to the current proportion in the pool.2. Specification
2.1. AMM and Frozen Asset
2.1.1. Prohibiting the Deposit of New Tokens
This proposal introduces changes to the behavior of the
AMMDeposit
transaction when tokens in trustlines interact with Automated Market Maker (AMM) pools.Assume we have created an Automated Market Maker (AMM) pool with two assets: A and B. Currently, asset A is frozen (either individually or globally). The following table outlines whether specific scenarios are allowed or prohibited for the current behavior and proposed behavior:
As illustrated in the table above, the primary change is that when one asset in the AMM pool is frozen, depositing the other asset is no longer allowed. This means that deposits are prohibited for the non-frozen asset when its paired asset is frozen.
2.1.2. Prohibiting the Transfer of Frozen LPTokens
The document introduces a new defintion:
Currently, the ledger permits the creation of offers involving frozen LPTokens and allows for direct and cross-currency payments using these tokens. Additionally, holders of frozen LPTokens can still transfer them, potentially enabling redemption by other accounts.
This document proposes breaking changes to the offers and payment engine to prevent the transfer of frozen LPTokens.
2.1.2.1. Offers
This proposal introduces a new change to the
OfferCreate
transaction to prevent the creation of offers that involve sending frozen LPTokens. Specifically:TakerGets
) field specifies a frozen LPToken, theOfferCreate
transaction will return atecFROZEN
error.Moreover, any existing offers with
TakerGets
set to a frozen LPToken can no longer be consumed and will be considered as an unfunded offer that will be implicitly cancelled by new Offers that cross it.2.1.2.2. Rippling
We propose modifying the rippling step of the payment engine to include a new failure condition: if the sender attempts to send LPTokens and one or more assets in the associated pool are frozen, the rippling step will fail.
Example
Let's consider the following example:
Currently, at Step 5, Alice can successfully transfer LPTokens to Bob through the AMM account as the gateway. This proposal introduces a change of behavior: Alice fails to send LPToken to Bob because her USD trustline is frozen.
2.1.2.3. Order Book
We propose modifying the order book step of the payment engine to include a failure condition: if an offer's
TakerGets
field specifies a frozen LPToken, the offer will be considered unfunded and any attempt to consume it will result in a step failure.Example
Let's consider the following example:
Currently, at Step 5, Alice can successfully transfer LPTokens to David through Bob's order book (which sells LPToken in exchange for XRP). This proposal introduces a change of behavior: Alice fails to send LPToken to David because Bob's offer is now considered to be unfunded and cannot be consumed.
2.2. AMM and Clawback
2.2.1. Allowing AMM Pool Creation with Clawback-Enabled Tokens
Currently, when clawback is enabled for the issuer account by setting
lsfAllowTrustLineClawback
flag,AMMCreate
is prohibited against this issuer. After the AMMClawback amendment,AMMCreate
is allowed for clawback-enabled issuer. But the issuer can not clawback from the AMM account usingClawback
transaction.AMMClawback
transaction is needed for the issuer to clawback from an AMM account.Example: Illustrating the AMMClawback Amendment
Suppose an issuer has enabled clawback by setting the
lsfAllowTrustLineClawback
flag through anAccountSet
transaction. Additionally, two trustlines have been established between the holder and the issuer for currencies A and BPre-Amendment Behavior:
AMMCreate
) using the pair of trustline assets A and B associated with the issuer, the transaction will fail with atecNO_PERMISSION
error.Post-Amendment Behavior:
AMMCreate
transaction to create an AMM pool with assets A and B, the transaction will be successful.AMMClawback
transaction instead of the regularClawback
transaction.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. Introducing a New Transaction for Clawback 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 codetecNO_PERMISSION
.By designating the AMM account, holder account, asset and amount, this transaction will:
Asset
which is issued by the issuer must exist in the specified AMM pool. Otherwise,tecNO_PERMISSION
will be returned.tfClawTwoAssets
flag is set, the paired asset which is also issued by the issuer, will return to issuer as well.tfClawTwoAssets
flag is not set, the paired asset will go back to the holder.tfClawTwoAssets
flag can only be set if the issuer issues both assets in the AMM pool. Otherwise,tecNO_PERMISSION
will be returned.2.2.2.1. Fields for AMMClawback transaction
TransactionType
string
UINT16
TransactionType
specifies the new transaction typeAMMClawback
. The integer value is 31. The recommended name isttAMM_CLAWBACK
.Account
string
ACCOUNT ID
Account
designates the issuer of the asset being clawed back, and must match the account submitting the transaction.Holder
string
ACCOUNT ID
Holder
specifies the holder account of the asset to be clawed back.AMMAccount
string
ACCOUNT ID
AMMAccount
specifies the AMM account from which the transaction will withdraw assets from. And the specified asset withdrawn from the pool will go back to the issuer.Asset
object
ISSUE
Asset
specifies the token that the issuer wants to claw back from the AMM pool.Asset
must exist in the AMM pool. If it does not, the system will return an error:tecNO_PERMISSION
.It has the following subfields:
issuer
currency
Amount
object
AMOUNT
Amount
specifies the amount of token to be clawed back from the AMM account. It should match theAsset
field.Amount
is not given, all the specified asset will be clawed back.Amount
exceeds the holder's current balance in the AMM pool, all the specified token will be clawed back.It has the following subfields:
issuer
currency
value
2.2.2.2. Flags
tfClawTwoAssets
Asset
token and the paired token will be clawed back.Asset
token will be clawed back, and the paired token will go back to the holder.2.2.2.3. AMMClawback transaction examples
2.2.2.3.1 Only one token is issued by the issuer
Assue we have an AMM pool consisting two tokens FOO and Bar. And the proportion of FOO and BAR is 1:2. And the issuer
rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL
only issues FOO, BAR is issued by some other account.rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL
to claw back at most 1000 FOO from AMM accountrp2MaZMQDpgAHwWbADaQMrmf4AD5JsPQUR
owned by holderrvYAfWj5gh67oV6fW32ZzP3Aw4Eubs59
.Account
will be returned to the issuerAccount
. So 1000 FOO will be returned to the issuerrPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL
.Amount
is not given or its subfieldvalue
exceeds the holder's available balance, then all the holder's FOO will be clawed back from the AMM account.tfClawTwoAssets
can not be set because BAR is not issued by the issuer.2.2.2.3.1 Both tokens are issued by the issuer
Assue we have an AMM pool consisting two tokens FOO and Bar. And the proportion of FOO and BAR is 1:2. And the issuer
rPdYxU9dNkbzC5Y2h4jLbVJ3rMRrk7WVRL
issues both FOO and BAR.tfClawTwoAssets
is set in theFlags
, so 1000 FOO and 2000 BAR will both go back to the issuer. (IftfClawTwoAssets
is not set in theFlags
, 1000 FOO will go back to the issuer and 2000 BAR will be transferred back to the holder.)Amount
is not given or its subfieldvalue
exceeds the holder's available balance, then we will claw back the holder's existing balance of FOO in the AMM pool. And whether BAR will be clawed back or go back to the holder is still determined by the flagtfClawTwoAssets
.2.2.2.3.1 Clawback all the tokens
Amount
field.tfClawTwoAssets
flag to determine whether the paired token will be clawed back or transferred back to the holder.Beta Was this translation helpful? Give feedback.
All reactions