Skip to content

Commit b3b944e

Browse files
committed
docs(fassets): enhance minting guide with detailed payment process and fee structure
1 parent 3bb15b0 commit b3b944e

File tree

1 file changed

+62
-9
lines changed

1 file changed

+62
-9
lines changed

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

Lines changed: 62 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ import FAssetsExecuteMinting from "!!raw-loader!/examples/developer-hub-javascri
1717

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

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.
2121

2222
See the [Minting](/fassets/minting) overview for more details.
2323

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

2929
## Minting Process Steps
3030

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

3333
1. Reserve collateral from a suitable agent.
3434
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:
3737

3838
## Reserve Collateral
3939

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.
45+
46+
| Fee Type | Paid In | Details |
47+
| ------------------------------------ | ---------------------------------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
48+
| **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+
4059
The following code demonstrates how to reserve collateral by calling the [`reserveCollateral`](/fassets/reference/IAssetManager#reservecollateral) function on the AssetManager contract.
4160

4261
<CodeBlock language="typescript" title="scripts/fassets/reserveCollateral.ts">
4362
{FAssetsReserveCollateral}
4463
</CodeBlock>
4564

46-
### Collateral Reservation Script Breakdown
65+
#### Collateral Reservation Script Breakdown
4766

4867
1. Define constants
4968

@@ -65,19 +84,53 @@ The following code demonstrates how to reserve collateral by calling the [`reser
6584

6685
## Send Payment on XRP Ledger
6786

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):
92+
93+
| Parameter | Unit | Purpose |
94+
| ----------------------------- | ------- | ---------------------------------------------------------------------------- |
95+
| `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.
69122

70123
<CodeBlock language="typescript" title="scripts/fassets/xrpPayment.ts">
71124
{FAssetsCreateXrpPayment}
72125
</CodeBlock>
73126

74-
### XRP Payment Script Breakdown
127+
#### XRP Payment Script Breakdown
75128

76-
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.
77130
2. Specify the correct constants from the reserve collateral script:
78131
- `AGENT_ADDRESS` - Agent's XRP Ledger address.
79132
- `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.
81134
3. Create a client to connect to the XRP Ledger Testnet.
82135
4. Load the sender wallet.
83136
5. Construct the payment transaction.
@@ -103,14 +156,14 @@ This script demonstrates how to retrieve the FDC proof and execute minting.
103156
2. Set the collateral reservation ID to the previously reserved minting request.
104157
3. Set the FDC round ID to retrieve the proof.
105158
4. Provide the FDC request data.
106-
5. Import the Asset manager contract artifact.
159+
5. Import the Asset Manager contract artifact.
107160
6. Define the function to prepare the FDC request.
108161
7. Create a function to get the proof from the FDC.
109162
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.
110163
8. Define the function to parse the events.
111164
9. Retrieve the FDC proof from the Data Availability Layer.
112165
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).
114167

115168
## Summary
116169

0 commit comments

Comments
 (0)