Skip to content

Commit 4bf0ffc

Browse files
committed
docs(fassets): modularize minting guide by incorporating MintingFees and PaymentTimeframes components
1 parent b3b944e commit 4bf0ffc

File tree

4 files changed

+65
-46
lines changed

4 files changed

+65
-46
lines changed

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

Lines changed: 4 additions & 43 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,8 @@ 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

@@ -39,20 +41,7 @@ The minting process involves the following steps:
3941

4042
Reserving collateral is the first step in the minting process.
4143

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-
:::
44+
<MintingFees />
5645

5746
### Reserve Collateral Script
5847

@@ -86,35 +75,7 @@ The following code demonstrates how to reserve collateral by calling the [`reser
8675

8776
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.
8877

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.
78+
<PaymentTimeframes />
11879

11980
### Payment Script
12081

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

Lines changed: 17 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,19 @@ 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. Before making the payment, it is important to understand the payment timeframes and constraints.
90+
91+
<PaymentTimeframes />
92+
93+
### Payment Script
94+
95+
After understanding the underlying payment timeframes, you can use the provided script to execute the payment.
8296

8397
<CodeBlock language="typescript" title="scripts/fassets/xrpPayment.ts">
8498
{FAssetsCreateXrpPayment}
8599
</CodeBlock>
86100

87-
### XRP Payment Script Breakdown
101+
#### XRP Payment Script Breakdown
88102

89103
1. Install the `xrpl` package — it's not included in the Flare Hardhat Starter Kit by default.
90104
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 provides 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)