Skip to content

Commit 6fb092d

Browse files
authored
feat(docs): add redeemAmount and redeemWithTag functions, and new events for redemption process (#1341)
1 parent 7916fb3 commit 6fb092d

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
@@ -404,6 +404,76 @@ function redeem(
404404
returns (uint256 _redeemedAmountUBA);
405405
```
406406

407+
### `redeemAmount`
408+
409+
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.
410+
411+
The `redeemAmount` function enforces a minimum redemption size `minimumRedeemAmount`.
412+
413+
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).
414+
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.
415+
The [`RedemptionAmountIncomplete`](/fassets/reference/IAssetManagerEvents#redemptionamountincomplete) event is emitted with the remaining amount.
416+
417+
Parameters:
418+
419+
- `_amountUBA`: Amount of redeemer's FAssets that will be burned (this is not the received amount; redemption fee is subtracted).
420+
- `_redeemerUnderlyingAddressString`: Address to which the agent must transfer the underlying amount.
421+
- `_executor`: Account that can execute redemption default (besides redeemer and agent).
422+
423+
Returns:
424+
425+
- `_redeemedAmountUBA`: Actual redeemed amount; may be less than requested when ticket availability or ticket limits apply.
426+
427+
```solidity
428+
function redeemAmount(
429+
uint256 _amountUBA,
430+
string memory _redeemerUnderlyingAddressString,
431+
address payable _executor
432+
) external payable
433+
returns (uint256 _redeemedAmountUBA);
434+
```
435+
436+
### `redeemWithTag`
437+
438+
Redeem up to `_amountUBA` FAssets and require a destination tag in the redemption XRPL payment.
439+
440+
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).
441+
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.
442+
The [`RedemptionAmountIncomplete`](/fassets/reference/IAssetManagerEvents#redemptionamountincomplete) event is emitted with the remaining amount.
443+
444+
Parameters:
445+
446+
- `_amountUBA`: Amount of redeemer's FAssets that will be burned (this is not the received amount; redemption fee is subtracted).
447+
- `_redeemerUnderlyingAddressString`: Address to which the agent must transfer the underlying amount.
448+
- `_executor`: Account that can execute redemption default (besides redeemer and agent).
449+
- `_destinationTag`: Destination tag required in redemption payment (XRP only; must fit in 32 bits for now).
450+
451+
Returns:
452+
453+
- `_redeemedAmountUBA`: Actual redeemed amount; may be less than requested when ticket availability or ticket limits apply.
454+
455+
```solidity
456+
function redeemWithTag(
457+
uint256 _amountUBA,
458+
string memory _redeemerUnderlyingAddressString,
459+
address payable _executor,
460+
uint256 _destinationTag
461+
) external payable
462+
returns (uint256 _redeemedAmountUBA);
463+
```
464+
465+
### `minimumRedeemAmountUBA`
466+
467+
Minimum amount in UBA for redemption with tag.
468+
Redemption requests with smaller amounts are rejected.
469+
This governance-configured minimum applies to both [`redeemAmount`](/fassets/reference/IAssetManager#redeemamount) and [`redeemWithTag`](/fassets/reference/IAssetManager#redeemwithtag) functions.
470+
471+
```solidity
472+
function minimumRedeemAmountUBA()
473+
external view
474+
returns (uint256);
475+
```
476+
407477
### `redemptionPaymentDefault`
408478

409479
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)