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