Skip to content

Commit 6079f82

Browse files
committed
feat(docs): add redeemAmount and redeemWithTag functions, and new events for redemption process
1 parent d3d31c0 commit 6079f82

3 files changed

Lines changed: 151 additions & 0 deletions

File tree

docs/fassets/reference/IAssetManager.mdx

Lines changed: 70 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -278,6 +278,76 @@ function redeem(
278278
returns (uint256 _redeemedAmountUBA);
279279
```
280280

281+
### `redeemAmount`
282+
283+
Redeem up to `_amountUBA` FAssets, like [`redeem`](/fassets/reference/IAssetManager#redeem), but accepts an arbitrary amount in UBA instead of whole lots and does not require a destination tag.
284+
285+
The `redeemAmount` function enforces a minimum redemption size `minimumRedeemAmount`.
286+
287+
In some cases, not all sent FAssets can be redeemed (for example, if there are insufficient tickets or the maximum ticket limit has been reached).
288+
In that case, only part of the approved assets are burned and redeemed, and the redeemer can call this method again for the remaining amount.
289+
The [`RedemptionAmountIncomplete`](/fassets/reference/IAssetManagerEvents#redemptionamountincomplete) event is emitted with the remaining amount.
290+
291+
Parameters:
292+
293+
- `_amountUBA`: Amount of redeemer's FAssets that will be burned (this is not the received amount; redemption fee is subtracted).
294+
- `_redeemerUnderlyingAddressString`: Address to which the agent must transfer the underlying amount.
295+
- `_executor`: Account that can execute redemption default (besides redeemer and agent).
296+
297+
Returns:
298+
299+
- `_redeemedAmountUBA`: Actual redeemed amount; may be less than requested when ticket availability or ticket limits apply.
300+
301+
```solidity
302+
function redeemAmount(
303+
uint256 _amountUBA,
304+
string memory _redeemerUnderlyingAddressString,
305+
address payable _executor
306+
) external payable
307+
returns (uint256 _redeemedAmountUBA);
308+
```
309+
310+
### `redeemWithTag`
311+
312+
Redeem up to `_amountUBA` FAssets and require a destination tag in the redemption XRPL payment.
313+
314+
In some cases, not all sent FAssets can be redeemed (for example, if there are insufficient tickets or the maximum ticket limit has been reached).
315+
In that case, only part of the approved assets are burned and redeemed, and the redeemer can call this method again for the remaining amount.
316+
The [`RedemptionAmountIncomplete`](/fassets/reference/IAssetManagerEvents#redemptionamountincomplete) event is emitted with the remaining amount.
317+
318+
Parameters:
319+
320+
- `_amountUBA`: Amount of redeemer's FAssets that will be burned (this is not the received amount; redemption fee is subtracted).
321+
- `_redeemerUnderlyingAddressString`: Address to which the agent must transfer the underlying amount.
322+
- `_executor`: Account that can execute redemption default (besides redeemer and agent).
323+
- `_destinationTag`: Destination tag required in redemption payment (XRP only; must fit in 32 bits for now).
324+
325+
Returns:
326+
327+
- `_redeemedAmountUBA`: Actual redeemed amount; may be less than requested when ticket availability or ticket limits apply.
328+
329+
```solidity
330+
function redeemWithTag(
331+
uint256 _amountUBA,
332+
string memory _redeemerUnderlyingAddressString,
333+
address payable _executor,
334+
uint256 _destinationTag
335+
) external payable
336+
returns (uint256 _redeemedAmountUBA);
337+
```
338+
339+
### `minimumRedeemAmountUBA`
340+
341+
Minimum amount in UBA for redemption with tag.
342+
Redemption requests with smaller amounts are rejected.
343+
This governance-configured minimum applies to both [`redeemAmount`](/fassets/reference/IAssetManager#redeemamount) and [`redeemWithTag`](/fassets/reference/IAssetManager#redeemwithtag) functions.
344+
345+
```solidity
346+
function minimumRedeemAmountUBA()
347+
external view
348+
returns (uint256);
349+
```
350+
281351
### `redemptionPaymentDefault`
282352

283353
If the agent fails to transfer the redeemed underlying assets in a timely manner, the redeemer or appointed executor can invoke this method and receive payment in collateral.

docs/fassets/reference/IAssetManagerEvents.mdx

Lines changed: 58 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -222,6 +222,48 @@ event RedemptionRequested(
222222
uint256 executorFeeNatWei);
223223
```
224224

225+
### `RedemptionWithTagRequested`
226+
227+
Emitted when the redeemer starts redemption with the tag and provides FAssets.
228+
The amount corresponding to `valueUBA` FAssets is burned.
229+
230+
Several `RedemptionWithTagRequested` events can be emitted in a single redemption call (one per redeemed agent, with multiple tickets for the same agent combined).
231+
The agent's collateral remains locked at this stage.
232+
233+
Parameters:
234+
235+
- `agentVault`: Address of the agent vault.
236+
- `redeemer`: Address of the redeemer.
237+
- `requestId`: Unique identifier for the redemption request.
238+
- `paymentAddress`: Address on the underlying chain to which the agent must transfer the payment.
239+
- `valueUBA`: Amount redeemed in underlying base units.
240+
- `feeUBA`: Redemption fee in underlying base units.
241+
- `firstUnderlyingBlock`: First underlying block in the valid payment window.
242+
- `lastUnderlyingBlock`: Last underlying block in the valid payment window.
243+
- `lastUnderlyingTimestamp`: Last underlying timestamp in the valid payment window.
244+
- `paymentReference`: Payment reference that must be used in the underlying payment.
245+
- `executor`: Address allowed to execute redemption default (besides redeemer and agent).
246+
- `executorFeeNatWei`: Fee paid to the executor in NAT wei.
247+
- `destinationTag`: Destination tag required for the XRP payment.
248+
249+
```solidity
250+
event RedemptionWithTagRequested(
251+
address indexed agentVault,
252+
address indexed redeemer,
253+
uint256 indexed requestId,
254+
string paymentAddress,
255+
uint256 valueUBA,
256+
uint256 feeUBA,
257+
uint256 firstUnderlyingBlock,
258+
uint256 lastUnderlyingBlock,
259+
uint256 lastUnderlyingTimestamp,
260+
bytes32 paymentReference,
261+
address executor,
262+
uint256 executorFeeNatWei,
263+
uint256 destinationTag
264+
);
265+
```
266+
225267
### `RedemptionTicketCreated`
226268

227269
This event is emitted when a redemption ticket is created, when a minting transaction is executed.
@@ -302,6 +344,22 @@ event RedemptionRequestIncomplete(
302344
);
303345
```
304346

347+
### `RedemptionAmountIncomplete`
348+
349+
Emitted when only a partial redemption can occur, for instance, if there are insufficient redemption tickets or if fulfilling the entire request would exceed the allowed ticket limit.
350+
351+
Parameters:
352+
353+
- `redeemer`: Address of the user who requested redemption.
354+
- `remainingAmountUBA`: Amount (UBA) that could not be redeemed and is returned.
355+
356+
```solidity
357+
event RedemptionAmountIncomplete(
358+
address indexed redeemer,
359+
uint256 remainingAmountUBA
360+
);
361+
```
362+
305363
### `RedemptionDefault`
306364

307365
Emitted when a redemption payment times out and the redeemer is compensated with collateral instead.

src/features/FAssets/OperationalParameters/operational-parameters.ts

Lines changed: 23 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -155,6 +155,29 @@ export const operationalParameters = [
155155
},
156156
},
157157
},
158+
{
159+
name: "Minimum Redeem Amount",
160+
settingName: "minimumRedeemAmountUBA",
161+
link: "/fassets/reference/IAssetManager#minimumredeemamountuba",
162+
description:
163+
"Minimum amount that can be redeemed, in base unit of the underlying asset (UBA).",
164+
values: {
165+
flare: {
166+
xrp: "-",
167+
},
168+
coston2: {
169+
xrp: "5 TestXRP",
170+
},
171+
songbird: {
172+
xrp: "-",
173+
},
174+
coston: {
175+
xrp: "-",
176+
btc: "-",
177+
doge: "-",
178+
},
179+
},
180+
},
158181
],
159182
},
160183
{

0 commit comments

Comments
 (0)