Skip to content

Commit 1fa65e2

Browse files
authored
docs(fassets): enhance minting guide with detailed payment process and fee structure (#984)
1 parent 3bb15b0 commit 1fa65e2

File tree

4 files changed

+86
-12
lines changed

4 files changed

+86
-12
lines changed

docs/fassets/developer-guides/5-fassets-mint.mdx

Lines changed: 24 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -12,12 +12,14 @@ import Remix from "@site/src/components/remix";
1212
import FAssetsReserveCollateral from "!!raw-loader!/examples/developer-hub-javascript/fassetsReserveCollateral.ts";
1313
import FAssetsCreateXrpPayment from "!!raw-loader!/examples/developer-hub-javascript/fassetsCreateXrpPayment.ts";
1414
import FAssetsExecuteMinting from "!!raw-loader!/examples/developer-hub-javascript/fassetsExecuteMinting.ts";
15+
import MintingFees from "./_minting_fees.mdx";
16+
import PaymentTimeframes from "./_payment_timeframes.mdx";
1517

1618
## Overview
1719

1820
This guide walks you through the complete process of minting FAssets (e.g., FXRP) on the Flare network.
1921

20-
Minting FAssets is the process of wrapping, for instance, XRP from the XRP Ledger into an FAsset, enabling it to be used within the Flare blockchain ecosystem.
22+
Minting FAssets is the process of wrapping underlying tokens (e.g., XRP from the XRP Ledger) into FAssets, enabling them to be used within the Flare blockchain ecosystem.
2123

2224
See the [Minting](/fassets/minting) overview for more details.
2325

@@ -28,7 +30,7 @@ See the [Minting](/fassets/minting) overview for more details.
2830

2931
## Minting Process Steps
3032

31-
The minting process is a multi-step process that involves the following steps:
33+
The minting process involves the following steps:
3234

3335
1. Reserve collateral from a suitable agent.
3436
2. Send the underlying asset (e.g., XRP) to the agent.
@@ -37,13 +39,19 @@ The minting process is a multi-step process that involves the following steps:
3739

3840
## Reserve Collateral
3941

42+
Reserving collateral is the first step in the minting process.
43+
44+
<MintingFees />
45+
46+
### Reserve Collateral Script
47+
4048
The following code demonstrates how to reserve collateral by calling the [`reserveCollateral`](/fassets/reference/IAssetManager#reservecollateral) function on the AssetManager contract.
4149

4250
<CodeBlock language="typescript" title="scripts/fassets/reserveCollateral.ts">
4351
{FAssetsReserveCollateral}
4452
</CodeBlock>
4553

46-
### Collateral Reservation Script Breakdown
54+
#### Collateral Reservation Script Breakdown
4755

4856
1. Define constants
4957

@@ -65,19 +73,26 @@ The following code demonstrates how to reserve collateral by calling the [`reser
6573

6674
## Send Payment on XRP Ledger
6775

68-
The next step is to send the XRP Ledger payment to the agent, and you can use this script to do that.
76+
The next step is to send the XRP Ledger payment to the agent.
77+
Before making the payment, it is important to understand the payment timeframes and constraints.
78+
79+
<PaymentTimeframes />
80+
81+
### Payment Script
82+
83+
After understanding the underlying payment timeframes, you can use the provided script to execute the payment.
6984

7085
<CodeBlock language="typescript" title="scripts/fassets/xrpPayment.ts">
7186
{FAssetsCreateXrpPayment}
7287
</CodeBlock>
7388

74-
### XRP Payment Script Breakdown
89+
#### XRP Payment Script Breakdown
7590

76-
1. Install the `xrpl` package — it's not included in the Flare Hardhat Starter Kit by default.
91+
1. Install the `xrpl` package — it is not included in the Flare Hardhat Starter Kit by default.
7792
2. Specify the correct constants from the reserve collateral script:
7893
- `AGENT_ADDRESS` - Agent's XRP Ledger address.
7994
- `AMOUNT_XRP` - XRP amount to send.
80-
- `PAYMENT_REFERENCE` - Payment reference from the the reserve collateral script.
95+
- `PAYMENT_REFERENCE` - Payment reference from the reserve collateral script.
8196
3. Create a client to connect to the XRP Ledger Testnet.
8297
4. Load the sender wallet.
8398
5. Construct the payment transaction.
@@ -103,14 +118,14 @@ This script demonstrates how to retrieve the FDC proof and execute minting.
103118
2. Set the collateral reservation ID to the previously reserved minting request.
104119
3. Set the FDC round ID to retrieve the proof.
105120
4. Provide the FDC request data.
106-
5. Import the Asset manager contract artifact.
121+
5. Import the Asset Manager contract artifact.
107122
6. Define the function to prepare the FDC request.
108123
7. Create a function to get the proof from the FDC.
109124
It sends a POST request to the [Flare Data Availability Layer](/fdc/overview#data-availability-layer) and returns a Merkle proof and attestation response from FDC.
110125
8. Define the function to parse the events.
111126
9. Retrieve the FDC proof from the Data Availability Layer.
112127
10. Call the [`executeMinting`](/fassets/reference/IAssetManager#executeminting) function on the AssetManager contract and send a transaction to the Flare network to convert the attested XRP payment into FXRP (minting).
113-
11. On a successful transaction call `parseExecutemintingEvents` to extract and log events [`RedemptionTicketCreated`](/fassets/reference/IAssetManagerEvents#redemptionticketcreated) and [`MintingExecuted`](/fassets/reference/IAssetManagerEvents#mintingexecuted).
128+
11. On a successful transaction call the `parseExecutemintingEvents` function to extract and log events [`RedemptionTicketCreated`](/fassets/reference/IAssetManagerEvents#redemptionticketcreated) and [`MintingExecuted`](/fassets/reference/IAssetManagerEvents#mintingexecuted).
114129

115130
## Summary
116131

docs/fassets/developer-guides/6-fassets-mint-executor.mdx

Lines changed: 18 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ import Remix from "@site/src/components/remix";
1212
import FAssetsReserveCollateralWithExecutor from "!!raw-loader!/examples/developer-hub-javascript/fassetsReserveCollateralWithExecutor.ts";
1313
import FAssetsCreateXrpPayment from "!!raw-loader!/examples/developer-hub-javascript/fassetsCreateXrpPayment.ts";
1414
import FAssetsExecuteMinting from "!!raw-loader!/examples/developer-hub-javascript/fassetsExecuteMinting.ts";
15+
import MintingFees from "./_minting_fees.mdx";
16+
import PaymentTimeframes from "./_payment_timeframes.mdx";
1517

1618
## Overview
1719

@@ -47,13 +49,19 @@ The minting process involves the following steps:
4749

4850
## Reserve Collateral
4951

52+
Reserving collateral is the first step in the minting process.
53+
54+
<MintingFees />
55+
56+
### Reserve Collateral Script
57+
5058
The following code demonstrates how to reserve collateral by calling the [`reserveCollateral`](/fassets/reference/IAssetManager#reservecollateral) function on the AssetManager contract.
5159

5260
<CodeBlock language="typescript" title="scripts/fassets/reserveCollateral.ts">
5361
{FAssetsReserveCollateralWithExecutor}
5462
</CodeBlock>
5563

56-
### Collateral Reservation Script Breakdown
64+
#### Collateral Reservation Script Breakdown
5765

5866
1. Define constants
5967

@@ -78,13 +86,20 @@ The following code demonstrates how to reserve collateral by calling the [`reser
7886

7987
## Send Payment on XRP Ledger
8088

81-
The next step is to send the XRP Ledger payment to the agent, and you can use this script to do that.
89+
The next step is to send the XRP Ledger payment to the agent.
90+
Before making the payment, it is important to understand the payment timeframes and constraints.
91+
92+
<PaymentTimeframes />
93+
94+
### Payment Script
95+
96+
After understanding the underlying payment timeframes, you can use the provided script to execute the payment.
8297

8398
<CodeBlock language="typescript" title="scripts/fassets/xrpPayment.ts">
8499
{FAssetsCreateXrpPayment}
85100
</CodeBlock>
86101

87-
### XRP Payment Script Breakdown
102+
#### XRP Payment Script Breakdown
88103

89104
1. Install the `xrpl` package — it's not included in the Flare Hardhat Starter Kit by default.
90105
2. Specify the correct constants from the reserve collateral script:
Lines changed: 14 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,14 @@
1+
### Minting Fees
2+
3+
When reserving collateral, there are several fees that are paid.
4+
5+
| Fee Type | Paid In | Details |
6+
| ------------------------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
7+
| **Collateral Reservation Fee (CRF)** | Native tokens (FLR/SGB) | Compensates the agent and the collateral pool token (CPT) holders for locking their collateral during the minting process. Defined by governance as a percentage of the minted value. |
8+
| **Minting Fee** | Underlying currency (e.g., XRP for FXRP) | Main source of revenue for the agents and the CPT holders. Percentage of the minted amount (varies by agent). |
9+
| **Executor Fee (Optional)** | Native tokens (FLR/SGB) | Incentivizes the executor to process minting requests. Configurable fee denominated in FLR. |
10+
11+
:::info[Collateral Reservation Fee (CRF)]
12+
If minting fails, the Collateral Reservation Fee is not returned to the minter.
13+
It is distributed to the agent and the pool in the same manner as the minting fee.
14+
:::
Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
### Payment Timeframes
2+
3+
The minting process has specific timeframes for underlying payments, controlled by [operational parameters](/fassets/operational-parameters):
4+
5+
| Parameter | Unit | Purpose |
6+
| ----------------------------- | ------- | ---------------------------------------------------------------------------- |
7+
| `underlyingSecondsForPayment` | seconds | The minimum time allowed for a minter to pay on the underlying chain |
8+
| `underlyingBlocksForPayment` | blocks | The number of underlying blocks during which the minter can make the payment |
9+
10+
These parameters work together as a dual safety mechanism that ensures payment happens within a reasonable number of blocks and guarantees payment occurs within a reasonable amount of time.
11+
12+
Both constraints must be satisfied for the payment to be considered valid.
13+
14+
#### Payment Deadline Calculation
15+
16+
When you reserve collateral, the system emits the following values in the [`CollateralReserved`](/fassets/reference/IAssetManagerEvents#collateralreserved) event:
17+
18+
- `lastUnderlyingBlock`: The final block number for a valid payment.
19+
- `lastUnderlyingTimestamp`: The deadline timestamp for payment.
20+
21+
Valid payments must occur **before both the last block AND the last timestamp**.
22+
23+
#### Payment Failure Handling
24+
25+
If the minter [fails to pay on the underlying chain](/fassets/minting#payment-failure) within the required timeframe:
26+
27+
- The agent must prove [nonpayment](/fdc/attestation-types/referenced-payment-nonexistence) using the [Flare Data Connector](/fdc/overview).
28+
- After nonpayment is proved, the agent's collateral that was reserved is released.
29+
- The agent receives the [Collateral Reservation Fee](/fassets/minting#collateral-reservation-fee), which is not returned to the minter.
30+
- The minter loses the opportunity to mint and must restart the process.

0 commit comments

Comments
 (0)