Skip to content

Commit b8c76d9

Browse files
feat(docs): add fassets cycle guide
1 parent e8e7e70 commit b8c76d9

File tree

2 files changed

+91
-3
lines changed

2 files changed

+91
-3
lines changed

docs/smart-accounts/guides/01-fsa-cli.mdx

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,6 @@ smart_accounts [-h] [--version] {bridge,debug} ...
5454

5555
## `bridge` command
5656

57-
{/* TODO:(Nik) check if the second sentence is still true */}
5857
The `bridge` command executes an XRPL transaction with instructions for one of the actions, determined by the positional argument provided.
5958
A payment transaction with the appropriate memo field value is sent to the operator's XRPL address from the XRPL address specified in the `.env` file.
6059

@@ -164,8 +163,7 @@ Check the status of the XRPL transaction with the `xrpl_hash`.
164163

165164
### `simulation`
166165

167-
{/* Run the simulation of the [FAsset cycle](/smart-accounts/guides/fassets-cycle). */}
168-
Run the simulation of the FAsset cycle.
166+
Run the simulation of the [FAsset cycle](/smart-accounts/guides/fassets-cycle).
169167
It converts `mint` lots of XRP to FXRP, deposits `deposit` FXRP into the Firelight vault, withdraws `deposit` FXRP back to the smart account, and finally redeems `mint` FXRP back to XRP.
170168

171169
```sh
Lines changed: 90 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,90 @@
1+
---
2+
sidebar_position: 1
3+
slug: fassets-cycle
4+
title: FAssets Cycle
5+
authors: [nikerzetic, filipkoprivec]
6+
description: An overview of the FAssets cycle with the use of Flare Smart Accounts.
7+
tags: [intermediate, ethereum, flare-smart-accounts]
8+
keywords:
9+
[
10+
flare-fdc,
11+
ethereum,
12+
flare-smart-accounts,
13+
evm,
14+
flare-network,
15+
account-abstraction,
16+
]
17+
unlisted: false
18+
---
19+
20+
import ThemedImage from "@theme/ThemedImage";
21+
import useBaseUrl from "@docusaurus/useBaseUrl";
22+
23+
In this guide we will walk you through all aspects of the [FAssets](/fassets/overview) process.
24+
We will start with an account on XRPL, we will send its assets to Flare, and then return them back to XRPL.
25+
The steps we will take will be as follows:
26+
27+
1. `mint`: convert XRP to FXRP
28+
2. `deposit`: deposit FXRP to the Firelight vault
29+
3. `withdraw`: withdraw FXRP from the Firelight vault
30+
4. `redeem`: convert FXRP back to XRP
31+
32+
We will do all of that through the [Flare Smart Accounts CLI](/smart-accounts/guides/fsa-cli).
33+
The CLI allows us to make XRPL transactions through terminal commands.
34+
35+
:::note
36+
The idea behind the Flare Smart Accounts is that we perform actions on the Flare chain through instructions sent on XRPL.
37+
:::
38+
39+
## Mint
40+
41+
First, we mint FXRP by reserving the necessary collateral and then sending XRP to the agent's underlying address.
42+
We will mint `1` lot of FXRP, with the agent at the address `0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC`.
43+
The CLI command that does this is:
44+
45+
```sh
46+
./smart_accounts.py bridge mint -a 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC -l 1
47+
```
48+
49+
The CLI sends both the `reserveCollateral` instruction and the `Payment` transaction to the agent's underlying address.
50+
51+
## Deposit
52+
53+
Next, we deposit `1` FXRP into the Firelight vault, specified by the `MasterAccountController` contract.
54+
Here, the CLI sends the `deposit` instruction.
55+
The command is:
56+
57+
```sh
58+
./smart_accounts.py bridge deposit -a 1
59+
```
60+
61+
## Withdraw
62+
63+
We withdraw the same number of tokens that we have just deposited from the Firelight vault.
64+
The process involves two steps.
65+
The CLI first sends the `withdraw` instruction, and afterwards, the `claimWithdraw`.
66+
The first instructions starts the withdrawal process, and the second claims the FXRP once it is released.
67+
68+
We use the command:
69+
70+
```sh
71+
./smart_accounts.py bridge withdraw -a 1
72+
```
73+
74+
## Redeem
75+
76+
The last step is to convert FXRP back to XRP.
77+
We will redeem the `1` lot of FXRP we minted in the first step back to XRP.
78+
We will invoke the CLI with the following command.
79+
80+
```sh
81+
./smart_accounts.py bridge redeem -a 1
82+
```
83+
84+
## Simulation
85+
86+
The above cycle can be simulated with a single CLI command:
87+
88+
```sh
89+
./smart_accounts.py debug simulation -a 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC -m 1 -d 1
90+
```

0 commit comments

Comments
 (0)