Skip to content

Commit 45d7cf3

Browse files
WIP
1 parent ac90ad0 commit 45d7cf3

File tree

3 files changed

+101
-0
lines changed

3 files changed

+101
-0
lines changed
Lines changed: 81 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,81 @@
1+
---
2+
sidebar_position: 1
3+
slug: fasset-instructions
4+
title: FAsset Instructions
5+
authors: [nikerzetic, filipkoprivec]
6+
description: Using Flare Smart Accounts in the FAssets workflow.
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+
import YoutubeEmbed from "@site/src/components/youtube";
23+
24+
In this guide we will take a closer look at the Flare Smart Accounts instructions related to FAssets.
25+
FAsset is a trustless, over-collateralize bridge between XRPL and the Flare chain.
26+
The FXRP is a token representation of XRP on the Flare chain.
27+
FAssets allow XRPL users to partake in Flare's DeFi ecosystem using their XRP assets, without exchanging them for the FLR token.
28+
29+
Several steps of the FAsset process are performed as transactions on the Flare chain, which requires users to hold FLR token for paying gas fees.
30+
The Flare Smart Accounts sidestep this by allowing XRPL users to trigger these actions through `Payment` transactions on XRPL.
31+
Thus, the eradicate completely the need for XRPL users to hold any non-XRPL assets.
32+
33+
You can learn more about the FAssets in the [dedicated section](/fassets/overview/).
34+
35+
## `01` Deposit
36+
37+
Deposit an `amount` of FXRP from you account into the Firelight vault `depositVault`.
38+
The address `depositVault` is designated by the `MasterAccountController` contract, and the `amount` is read from the last 31 bytes of the payment reference.
39+
40+
A deposit payment reference is the 32 byte value:
41+
42+
```Solidity
43+
bytes32((uint256(01) << 248) | amount))
44+
```
45+
46+
`01` `amount`
47+
48+
## `02` Withdraw
49+
50+
Withdraw an `amount` of FXRP from the Firelight vault `depositVault`.
51+
The address `depositVault` is designated by the `MasterAccountController` contract, and the `amount` is read from the last 31 bytes of the payment reference.
52+
53+
A withdraw payment reference is the 32 byte value:
54+
55+
## `03` Approve
56+
57+
## `04` Redeem
58+
59+
## `05` Reserve collateral
60+
61+
Collateral reservation is the first step in the FAssets minting process.
62+
In anticipation of transfer of XRP to the agent's underlying address on XRPL a portion of its collateral is locked to prevent accidental under-collateralization.
63+
Since this action happens on the Flare chain, the gas fees need to be paid in the native FLR token.
64+
65+
The Flare Smart Accounts provide a service to XRPL users, where the operator
66+
{/* TODO:(Nik) make this sentence go somewhere */}
67+
68+
The reserveCollateral action reserves a number of `lots` of collateral of the `agentVault`.
69+
The process is performed by an `executor` with `executorFee` (explained in the [minting guide](/fassets/minting#executor-role));
70+
both of these are defined by the `MasterAccountController` contract.
71+
The `lots` and `agentVault` values are both read from the payment reference.
72+
73+
{/* TODO:(Nik) link to executor */}
74+
75+
A reserveCollateral payment reference is a 32 byte value, with:
76+
77+
- the hex representation of `05` on the first byte,
78+
- the `agentVault` address on the next 19 bytes,
79+
- and the `lots` number on the last 11 bytes.
80+
81+
## `06` Claim withdraw
Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
---
2+
sidebar_position: 1
3+
slug: custom-instruction
4+
title: Custom instruction
5+
authors: [nikerzetic, filipkoprivec]
6+
description: The Flare Smart Accounts is an account abstraction that performs actions on behalf of XRPL users.
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+
---

sidebars.ts

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -257,6 +257,8 @@ const sidebars: SidebarsConfig = {
257257
collapsed: true,
258258
link: { type: "doc", id: "smart-accounts/overview" },
259259
items: [
260+
"smart-accounts/fasset-instructions",
261+
"smart-accounts/custom-instruction",
260262
// {
261263
// type: "category",
262264
// label: "Developer Guides",

0 commit comments

Comments
 (0)