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
The `previewMint` function is part of the [ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) standard and returns the amount of assets required to mint a specific number of shares, accounting for the current exchange rate between assets and shares.
84
76
85
-
### 6. Approve Token Transfer
77
+
### 5. Approve Token Transfer
86
78
87
79
Before minting, the script must approve the vault to spend the required amount of assets:
Copy file name to clipboardExpand all lines: docs/fassets/firelight/status.mdx
+10-67Lines changed: 10 additions & 67 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -12,9 +12,9 @@ import FirelightStatus from "!!raw-loader!/examples/developer-hub-javascript/fir
12
12
13
13
## Overview
14
14
15
-
This guide demonstrates how to retrieve and display information about a Firelight vault, including vault metrics, period configuration, user balances, and withdrawal information.
15
+
This guide demonstrates how to retrieve information about a Firelight vault, including vault metrics, period configuration, user balances, and withdrawal information.
16
16
17
-
The Firelight vault is a[ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) vault architecture that works with [FAssets](/fassets/overview), allowing users to deposit FXRP tokens and earn rewards through a period-based system.
17
+
The Firelight vault is an[ERC-4626](https://eips.ethereum.org/EIPS/eip-4626) vault architecture compatible with [FAssets](/fassets/overview).
18
18
19
19
## Prerequisites
20
20
@@ -32,69 +32,14 @@ The following script retrieves and displays information about the Firelight vaul
32
32
33
33
## Script Breakdown
34
34
35
-
### 1. Script Setup
35
+
The script retrieves the following information:
36
36
37
-
The script starts by defining the Firelight vault address and importing the required contract interfaces:
38
-
39
-
-`FIRELIGHT_VAULT_ADDRESS`: The address of the Firelight vault contract on the [Flare Testnet Coston2 network](/network/overview).
40
-
-`IFirelightVault`: The interface for interacting with the Firelight vault contract.
41
-
Taken from the Firelight GitHub [repository](https://github.com/firelight-protocol/firelight-core/blob/main/contracts/FirelightVault.sol).
42
-
-`IERC20`: Standard [ERC-20](https://eips.ethereum.org/EIPS/eip-20) interface for token interactions.
43
-
44
-
### 2. Asset Information
45
-
46
-
The script retrieves basic asset information:
47
-
48
-
-**Asset address**: The underlying token address (e.g., FXRP).
49
-
-**Asset symbol**: The token symbol (e.g., "FXRP").
50
-
-**Asset decimals**: The number of decimals used by the token.
51
-
52
-
### 3. Vault Balances
53
-
54
-
The script displays key vault metrics:
55
-
56
-
-**Total assets**: The total amount of assets in the vault.
57
-
-**Total supply**: The total number of shares minted by the vault.
58
-
-**Exchange rate**: The current exchange rate between assets and shares, calculated as `totalAssets / totalSupply`.
59
-
60
-
### 4. Period Configuration
61
-
62
-
Firelight vaults operate on a [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic).
63
-
64
-
The script retrieves:
65
-
66
-
-**Period configurations count**: Total number of period configurations.
67
-
-**Current period**: The active period number.
68
-
-**Current period start**: Timestamp when the current period started.
69
-
-**Current period end**: Timestamp when the current period ends.
70
-
-**Next period end**: Timestamp when the next period will end.
71
-
-**Current period config**: Configuration details including:
72
-
-`epoch`: The epoch number.
73
-
-`duration`: Duration of the period in seconds.
74
-
-`startingPeriod`: The period when this configuration started.
75
-
76
-
### 5. User Information
77
-
78
-
For the connected account, the script displays:
79
-
80
-
-**User balance (shares)**: The number of vault shares owned by the user.
81
-
-**User balance (assets)**: The equivalent asset value of the user's shares.
82
-
-**Max deposit**: Maximum amount the user can deposit.
83
-
-**Max mint**: Maximum number of shares the user can mint.
84
-
-**Max withdraw**: Maximum amount of assets the user can withdraw.
85
-
-**Max redeem**: Maximum number of shares the user can redeem.
86
-
87
-
### 6. User Withdrawals and Redemptions
88
-
89
-
The script checks withdrawal and redemption information for:
90
-
91
-
-**Current period**: Withdrawals and redemptions requested in the current period.
92
-
-**Previous period**: Withdrawals and redemptions from the previous period.
93
-
94
-
For each period with pending withdrawals or redemptions, the script displays:
95
-
96
-
- Period number.
97
-
- Withdrawal or redemption amount in both raw units and formatted token units.
37
+
1.**Asset Information**: Token address, symbol, and decimals.
38
+
2.**Vault Balances**: Total assets, total supply (shares), and exchange rate.
39
+
3.**Period Configuration**: Current period details and timing information.
40
+
Firelight vaults operate on a [period-based logic](https://docs.firelight.finance/technical-documents#period-based-logic).
41
+
4.**User Information**: User balances (shares and assets), and maximum limits for deposit, mint, withdraw, and redeem.
42
+
5.**User Withdrawals and Redemptions**: Pending withdrawals and redemptions for the current and previous periods.
98
43
99
44
## Running the Script
100
45
@@ -145,9 +90,7 @@ Max redeem: 61
145
90
146
91
## Summary
147
92
148
-
In this guide, you learned how to retrieve status information from a Firelight vault.
149
-
150
-
This information is essential for building applications that interact with Firelight vaults and for monitoring vault health and user positions.
93
+
In this guide, you learned how to retrieve status information from a Firelight vault, including vault metrics, period configuration, user balances, and withdrawal information.
0 commit comments