You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Copy file name to clipboardExpand all lines: docs/fassets/developer-guides/5-fassets-mint.mdx
+62-9Lines changed: 62 additions & 9 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -17,7 +17,7 @@ import FAssetsExecuteMinting from "!!raw-loader!/examples/developer-hub-javascri
17
17
18
18
This guide walks you through the complete process of minting FAssets (e.g., FXRP) on the Flare network.
19
19
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.
20
+
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.
21
21
22
22
See the [Minting](/fassets/minting) overview for more details.
23
23
@@ -28,7 +28,7 @@ See the [Minting](/fassets/minting) overview for more details.
28
28
29
29
## Minting Process Steps
30
30
31
-
The minting process is a multi-step process that involves the following steps:
31
+
The minting process involves the following steps:
32
32
33
33
1. Reserve collateral from a suitable agent.
34
34
2. Send the underlying asset (e.g., XRP) to the agent.
@@ -37,13 +37,32 @@ The minting process is a multi-step process that involves the following steps:
37
37
38
38
## Reserve Collateral
39
39
40
+
Reserving collateral is the first step in the minting process.
41
+
42
+
### Minting Fees
43
+
44
+
When reserving collateral, there are several fees that are paid.
|**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. |
49
+
|**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). |
50
+
|**Executor Fee (Optional)**| Native tokens (FLR/SGB) | Incentivizes the executor to process minting requests. Configurable fee denominated in FLR. |
51
+
52
+
:::info[Collateral Reservation Fee (CRF)]
53
+
If minting fails, the Collateral Reservation Fee is not returned to the minter.
54
+
It is distributed to the agent and the pool in the same manner as the minting fee.
55
+
:::
56
+
57
+
### Reserve Collateral Script
58
+
40
59
The following code demonstrates how to reserve collateral by calling the [`reserveCollateral`](/fassets/reference/IAssetManager#reservecollateral) function on the AssetManager contract.
@@ -65,19 +84,53 @@ The following code demonstrates how to reserve collateral by calling the [`reser
65
84
66
85
## Send Payment on XRP Ledger
67
86
68
-
The next step is to send the XRP Ledger payment to the agent, and you can use this script to do that.
87
+
The next step is to send the XRP Ledger payment to the agent. Before making the payment, it is important to understand the payment timeframes and constraints.
88
+
89
+
### Payment Timeframes
90
+
91
+
The minting process has specific timeframes for underlying payments, controlled by [operational parameters](/fassets/operational-parameters):
|`underlyingSecondsForPayment`| seconds | The minimum time allowed for a minter to pay on the underlying chain |
96
+
|`underlyingBlocksForPayment`| blocks | The number of underlying blocks during which the minter can make the payment |
97
+
98
+
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.
99
+
Both constraints must be satisfied for the payment to be considered valid.
100
+
101
+
#### Payment Deadline Calculation
102
+
103
+
When you reserve collateral, the system provides in the [`CollateralReserved`](/fassets/reference/IAssetManagerEvents#collateralreserved) event:
104
+
105
+
-`lastUnderlyingBlock`: The final block number for a valid payment.
106
+
-`lastUnderlyingTimestamp`: The deadline timestamp for payment.
107
+
108
+
Valid payments must occur **before both the last block AND the last timestamp**.
109
+
110
+
#### Payment Failure Handling
111
+
112
+
If the minter [fails to pay on the underlying chain](/fassets/minting#payment-failure) within the required timeframe:
113
+
114
+
- The agent must prove [nonpayment](/fdc/attestation-types/referenced-payment-nonexistence) using the [Flare Data Connector](/fdc/overview).
115
+
- After nonpayment is proved, the agent's collateral that was reserved is released.
116
+
- The agent receives the [Collateral Reservation Fee](/fassets/minting#collateral-reservation-fee), which is not returned to the minter.
117
+
- The minter loses the opportunity to mint and must restart the process.
118
+
119
+
### Payment Script
120
+
121
+
After understanding the underlying payment timeframes, you can use the provided script to execute the payment.
1. Install the `xrpl` package — it's not included in the Flare Hardhat Starter Kit by default.
129
+
1. Install the `xrpl` package — it is not included in the Flare Hardhat Starter Kit by default.
77
130
2. Specify the correct constants from the reserve collateral script:
78
131
-`AGENT_ADDRESS` - Agent's XRP Ledger address.
79
132
-`AMOUNT_XRP` - XRP amount to send.
80
-
-`PAYMENT_REFERENCE` - Payment reference from the the reserve collateral script.
133
+
-`PAYMENT_REFERENCE` - Payment reference from the reserve collateral script.
81
134
3. Create a client to connect to the XRP Ledger Testnet.
82
135
4. Load the sender wallet.
83
136
5. Construct the payment transaction.
@@ -103,14 +156,14 @@ This script demonstrates how to retrieve the FDC proof and execute minting.
103
156
2. Set the collateral reservation ID to the previously reserved minting request.
104
157
3. Set the FDC round ID to retrieve the proof.
105
158
4. Provide the FDC request data.
106
-
5.ImporttheAssetmanagercontractartifact.
159
+
5.ImporttheAssetManagercontractartifact.
107
160
6. Define the function to prepare the FDC request.
108
161
7. Create a function to get the proof from the FDC.
109
162
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.
110
163
8. Define the function to parse the events.
111
164
9. Retrieve the FDC proof from the Data Availability Layer.
112
165
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).
166
+
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).
0 commit comments