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 following example demonstrates how to redeem FAssets using the `AssetManager` smart contract.
@@ -37,8 +32,9 @@ The following example demonstrates how to redeem FAssets using the `AssetManager
37
32
### Code Breakdown
38
33
39
34
1. Define the asset manager contract address to interact with it.
40
-
2.Get the asset manager settings to calculate the redeemed amount; for that, you need to get the `lotSizeAMG` and `assetDecimals` from the asset manager [settings](/fassets/developer-guides/fassets-settings-solidity).
35
+
2.Approve FAssets (FXRP) tokens for redemption.
41
36
3. Redeem the FAssets using the [`redeem`](/fassets/reference/IAssetManager#redeem) function by specifying the number of lots to redeem and the underlying chain address.
37
+
4. Retrieve the asset manager settings to calculate the redeemed amount; for this, you need to obtain the `lotSizeAMG` and `assetDecimals` from the asset manager settings [document](/fassets/developer-guides/fassets-settings-solidity).
42
38
43
39
:::info
44
40
In this example, you are not using the executor vault address, but you can use it to redeem FAssets on behalf of another address.
@@ -55,7 +51,7 @@ Create a new file, for example, `scripts/fassets/redeem.ts` and add the followin
55
51
At first, you need to import the required dependencies and smart contract TypeScript types:
56
52
57
53
```typescript
58
-
import { ethers, run } from"hardhat";
54
+
import { ethers, web3, run } from"hardhat";
59
55
import { formatUnits } from"ethers";
60
56
61
57
import {
@@ -72,14 +68,27 @@ Define the constants:
72
68
-`ASSET_MANAGER_ADDRESS` - asset manager address;
73
69
-`LOTS_TO_REDEEM` - the number of lots to redeem;
74
70
-`UNDERLYING_ADDRESS` - underlying chain address where the redeemed asset will be sent;
75
-
-`FXRP_TOKEN_ADDRESS` - FXRP token address.
76
71
77
72
```typescript
78
-
// AssetManager address on Songbird Testnet Coston network
@@ -109,36 +121,31 @@ async function deployAndVerifyContract() {
109
121
}
110
122
```
111
123
112
-
### Transfer FXRP to the Redeem Contract
124
+
### Approve the FXRP transfer to the Redeem Contract
113
125
114
-
To redeem FAssets, you must transfer a sufficient amount of FXRP to the `FAssetsRedeem` contract address after it is deployed, as it acts as the invoker during the redemption process.
126
+
To redeem FAssets, you must approve a sufficient amount of transfer of FXRP to the `FAssetsRedeem` contract address after it is deployed, as it acts as the invoker during the redemption process.
In a production environment, you should use a more secure method to transfer FXRP to a smart contract.
143
+
In a production environment, it is recommended to use a more secure method for approving the transfer of FXRP to a smart contract.
137
144
:::
138
145
139
146
### Parse the Redemption Events
140
147
141
-
During the redemption process, the `AssetManager` emits an events:
148
+
During the redemption process, the `AssetManager` emits events:
142
149
143
150
-[`RedemptionRequested`](/fassets/reference/IAssetManagerEvents#redemptionrequested) - holds the agent vault address, redemption request id, the amount of FAssets to redeem, and other important information.
144
151
-[`RedemptionTicketCreated`](/fassets/reference/IAssetManagerEvents#redemptionticketcreated) - holds the redemption ticket information updated during the redemption process.
@@ -148,7 +155,7 @@ To parse the redemption events, you can use the following function:
@@ -185,12 +192,12 @@ async function parseRedemptionEvents(
185
192
186
193
### Redeeming FAssets
187
194
188
-
To put it all together you can use the following function to deploy the contract, transfer FXRP to it, redeem the FAssets, and parse the redemption events:
195
+
To put it altogether you can use the following function to deploy the contract, transfer FXRP to it, redeem the FAssets, and parse the redemption events:
The event `RedemptionTicketUpdated`holds the redemption ticket information like agent vault address, redemption ticket ID and the value of the redemption ticket in underlying chain currency.
284
+
The event `RedemptionTicketUpdated`contains the redemption ticket information, including the agent vault address, redemption ticket ID, and the value of the redemption ticket in the underlying chain currency.
272
285
273
286
For every minting, a redemption ticket is created, and during the redemption process, the redemption ticket is updated with the new redemption status.
274
287
@@ -283,18 +296,18 @@ Arguments: Result(3) [
283
296
284
297
Once decoding the most important data from the event is:
285
298
286
-
- agent vault address that will redeem the FAssets is `0x3c831Fe4417bEFFAc721d24996985eE2dd627053`;
287
-
- redemption ticket id is `870`;
288
-
- value of the redemption ticket in underlying chain currency is `3440000000` (partially redeemed).
299
+
-The agent vault address that will redeem the FAssets is `0x3c831Fe4417bEFFAc721d24996985eE2dd627053`;
300
+
-The redemption ticket id is `870`;
301
+
-The value of the redemption ticket in underlying chain currency is `3440000000` (partially redeemed).
289
302
290
303
You can read the full event description [here](/fassets/reference/IAssetManagerEvents#redemptionticketupdated).
291
304
292
305
### Agent Process
293
306
294
-
The FAssets agent should perform the redemption, and the user needs to get the redeemed assets from the agent.
307
+
The FAssets agent should perform the redemption, and the user must retrieve the redeemed assets from the agent.
295
308
296
309
If the agent is unable to redeem the assets on the underlying chain in the specified time.
297
-
In that case, the user can execute the [`redemptionPaymentDefault`](/fassets/reference/IAssetManager#redemptionpaymentdefault) function to receive compensation from agent's collateral.
310
+
In that case, the user can execute the [`redemptionPaymentDefault`](/fassets/reference/IAssetManager#redemptionpaymentdefault) function to receive compensation from the agent's collateral.
298
311
299
312
If the agent rejects the redemption request and no other agent takes over the redemption, the redeemer or appointed executor calls [`rejectedRedemptionPaymentDefault`](/fassets/reference/IAssetManager#rejectedredemptionpaymentdefault) method and receives payment in collateral.
300
313
The agent can also call default if the redeemer is unresponsive to payout the redeemer and free the remaining collateral.
Copy file name to clipboardExpand all lines: docs/ftso/2-feeds.mdx
+12-2Lines changed: 12 additions & 2 deletions
Display the source diff
Display the rich diff
Original file line number
Diff line number
Diff line change
@@ -41,14 +41,24 @@ The resulting string is then prefixed with `0x`.
41
41
42
42
## Custom Feeds
43
43
44
-
:::warning
44
+
:::warning[Risk Profile]
45
45
46
-
Custom Feeds, introduced in [FIP.13](https://proposals.flare.network/FIP/FIP_13.html), have a distinct risk profile compared to standard FTSO feeds. Unlike standard FTSO feeds, the security of a Custom Feed is conditional on the logic defined in its smart contract.
46
+
Each Custom Feed has a unique risk profile determined by its smart contract and data source, which users and developers must assess individually.
47
47
48
48
:::
49
49
50
+
Custom Feeds, introduced in [FIP.13](https://proposals.flare.network/FIP/FIP_13.html), extend the FTSO by enabling developers to create onchain feeds for arbitrary time-series data.
51
+
Unlike standard FTSO feeds, which are secured by a decentralized network of data providers, Custom Feeds derive their values from logic defined in a developer-controlled smart contract.
52
+
This expands the FTSO's capabilities beyond traditional price pairs, allowing for a wider variety of data to be brought onto the Flare network, such as prices for Liquid Staked Tokens (LSTs), data from specific offchain APIs, or other bespoke datasets.
53
+
50
54
<CustomFeeds />
51
55
56
+
:::tip[Create a new Custom Feed]
57
+
58
+
Follow the [create a Custom Feed](/ftso/guides/create-custom-feed) guide to learn how a build a new Custom Feed.
59
+
60
+
:::
61
+
52
62
## Need more feeds?
53
63
54
64
FTSOv2 can scale up to 1000 feeds. If you need additional FTSOv2 feeds beyond what is currently available, you can raise a New Feed Request Issue on GitHub. When a feed request is submitted, it is reviewed by the FTSO Management Group, which is comprised of the FTSO data providers as outlined in [FIP.08](https://proposals.flare.network/FIP/FIP_8.html#222-through-the-ftso-management-group).
0 commit comments