Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions docs/smart-accounts/guides/01-fsa-cli.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -61,11 +61,11 @@ The command produces a payment reference corresponding to each instruction type.
For example, the following command

```sh
./smart_accounts.py encode mint -l 1
./smart_accounts.py encode deposit -a 1
```

would result in the payment reference `0100000000000000000000000000000000000000000000000000000000000001`.
The first `01` here signals that it is a `mint` instruction, while the remaining bytes give the amount - in this case `1`.
The first `01` here signals that it is a `deposit` instruction, while the remaining bytes give the amount - in this case `1`.

## `bridge` command

Expand Down
19 changes: 19 additions & 0 deletions docs/smart-accounts/guides/02-custom-instructions.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -119,6 +119,25 @@ This time, it works.
./smart_accounts.py bridge custom -a "0x296432C15504Ed465fAce11E54Ce4aac50cCd8A3" -v 1 -d "0423a132000000000000000000000000000000000000000000000000000000000000002a"
```

<details>
<summary>Expected output</summary>

The CLI prompts the user to press "enter" once in order to continue to the minting.
The number of `.` symbols, as well as XRPL transaction hashes are expected not to match the ones in this example.

```
sent instruction on underlying: 934945B8142E5CA10B2027B17364D587C483C61F562E2B28EF251EF3F9D0A6E5
https://testnet.xrpl.org/transactions/934945B8142E5CA10B2027B17364D587C483C61F562E2B28EF251EF3F9D0A6E5/detailed

waiting to bridge...........
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0x0b889937eeb43b660ffe44b23c149a540af41c8a04ae656481a15a9ffe310953
https://coston2-explorer.flare.network/tx/0x0b889937eeb43b660ffe44b23c149a540af41c8a04ae656481a15a9ffe310953?tab=logs

```

</details>

### Mocking

We can speed up the process, as well as simplify it, by using the Flare Smart Accounts CLI.
Expand Down
165 changes: 160 additions & 5 deletions docs/smart-accounts/guides/03-fassets-cycle.mdx
Original file line number Diff line number Diff line change
Expand Up @@ -43,9 +43,35 @@ We will mint `1` lot of FXRP, with the agent at the address `0x55c815260cBE6c45F
The CLI command that does this is:

```sh
./smart_accounts.py bridge mint -a 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC -l 1
./smart_accounts.py bridge mint --agent-address 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC --lots 1
```

<details>
<summary>Expected output</summary>

The CLI prompts the user to press "enter" once in order to continue to the minting.
The number of `.` symbols, as well as XRPL transaction hashes are expected not to match the ones in this example.

```
sent instruction on underlying: D1F3F68060C34771DD603C4597D20FF4EFFA53FCB1A9D3F2A06272CC1BB2BCB0
https://testnet.xrpl.org/transactions/D1F3F68060C34771DD603C4597D20FF4EFFA53FCB1A9D3F2A06272CC1BB2BCB0/detailed

waiting to bridge...........
BRIDGED FOR 0xDC47B18B7aDC3DeaCA42651cAF5A91397b57BAD3
successfully bridged in tx 0xb64a6e46613aac437fc2ee3ed418f8f872e20d9aba7c95cc003f9f54dfec3553
https://coston2-explorer.flare.network/tx/0xb64a6e46613aac437fc2ee3ed418f8f872e20d9aba7c95cc003f9f54dfec3553?tab=logs

successful collateral reservation, continue to 2nd part of mint... press enter
sent underlying assets in 0708E84E5E69731328DD357BDD934205A002876B8801813B7002EE315BB2AE8D
https://testnet.xrpl.org/transactions/0708E84E5E69731328DD357BDD934205A002876B8801813B7002EE315BB2AE8D/detailed
waiting for mint execution.............
successfully minted in tx 0x5e78e235dbfc7f0c1356635277b70bbaefe7ce01a948309fea9bb56d8e26d3d0
https://coston2-explorer.flare.network/tx/0x5e78e235dbfc7f0c1356635277b70bbaefe7ce01a948309fea9bb56d8e26d3d0?tab=logs

```

</details>

The CLI sends both the `reserveCollateral` instruction and the `Payment` transaction to the agent's underlying address.

## Deposit
Expand All @@ -55,9 +81,29 @@ Here, the CLI sends the `deposit` instruction.
The command is:

```sh
./smart_accounts.py bridge deposit -a 1
./smart_accounts.py bridge deposit --amount 1
```

<details>
<summary>Expected output</summary>

The CLI prompts the user to press "enter" once in order to continue to the minting.
The number of `.` symbols, as well as XRPL transaction hashes are expected not to match the ones in this example.

```
sent instruction on underlying: 185EE71ECEC28C5902D45ED8AB5FCB9A6F78845EE99EC4A66F81655F78EADC87
https://testnet.xrpl.org/transactions/185EE71ECEC28C5902D45ED8AB5FCB9A6F78845EE99EC4A66F81655F78EADC87/detailed

waiting to bridge...............
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0x12a69822e5d399a8918ff116a049b714ef76c29e1497857148e9fbc602d7994d
https://coston2-explorer.flare.network/tx/0x12a69822e5d399a8918ff116a049b714ef76c29e1497857148e9fbc602d7994d?tab=logs


```

</details>

## Withdraw

We withdraw the same number of tokens that we have just deposited from the Firelight vault.
Expand All @@ -68,8 +114,28 @@ The first instruction starts the withdrawal process, and the second claims the F
We use the command:

```sh
./smart_accounts.py bridge withdraw -a 1
./smart_accounts.py bridge withdraw --amount 1
```

<details>
<summary>Expected output</summary>

The CLI prompts the user to press "enter" once in order to continue to the minting.
The number of `.` symbols, as well as XRPL transaction hashes are expected not to match the ones in this example.

```
sent instruction on underlying: 2B1F76520C3EE921E22FE79F3DA29B1F2C64E602CD2A1C87F372E0AB8E75B270
https://testnet.xrpl.org/transactions/2B1F76520C3EE921E22FE79F3DA29B1F2C64E602CD2A1C87F372E0AB8E75B270/detailed

waiting to bridge...........
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0x43c13369b678c0e671d70035f8140b2cd6f4309735bce03d9e9fd0cc994792d7
https://coston2-explorer.flare.network/tx/0x43c13369b678c0e671d70035f8140b2cd6f4309735bce03d9e9fd0cc994792d7?tab=logs


```

</details>

## Redeem

Expand All @@ -78,13 +144,102 @@ We will redeem the `1` lot of FXRP we minted in the first step back to XRP.
We will invoke the CLI with the following command.

```sh
./smart_accounts.py bridge redeem -a 1
./smart_accounts.py bridge redeem --lots 1
```

<details>
<summary>Expected output</summary>

The CLI prompts the user to press "enter" once in order to continue to the minting.
The number of `.` symbols, as well as XRPL transaction hashes are expected not to match the ones in this example.

```
sent instruction on underlying: 1D6A35CB521D16E7379D0F1D4D1C4A8BB49497C4FDC27446C5D775605B802881
https://testnet.xrpl.org/transactions/1D6A35CB521D16E7379D0F1D4D1C4A8BB49497C4FDC27446C5D775605B802881/detailed

waiting to bridge............
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0x0600342c3a49f20676f3e1744a78f3c010e315c2f4da65edee047fa757605bb0
https://coston2-explorer.flare.network/tx/0x0600342c3a49f20676f3e1744a78f3c010e315c2f4da65edee047fa757605bb0?tab=logs

```

</details>

## Simulation

The above cycle can be simulated with a single CLI command:

```sh
./smart_accounts.py debug simulation -a 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC -m 1 -d 1
./smart_accounts.py debug simulation --agent-address 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC --mint 1 --deposit 1
```

<details>
<summary>Expected output</summary>

The CLI prompts the user to press "enter" five times in order to continue.
The number of `.` symbols, as well as XRPL transaction hashes are expected not to match the ones in this example.

```
sent instruction on underlying: AF8BDE9810B64B442F5D50C37D176B101996B75ED1586233028AC964606849B4
https://testnet.xrpl.org/transactions/AF8BDE9810B64B442F5D50C37D176B101996B75ED1586233028AC964606849B4/detailed

waiting to bridge................
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0xa25fcb34183e509948140346bd5d50b87c9af7b2ba1a597e116c9435d33a0602
https://coston2-explorer.flare.network/tx/0xa25fcb34183e509948140346bd5d50b87c9af7b2ba1a597e116c9435d33a0602?tab=logs

successful collateral reservation, continue to 2nd part of mint... press enter
sent underlying assets in 7710196AF58BF63B1260E6B999C0FDAAA032F059713CE46D1E6F39853523FA52
https://testnet.xrpl.org/transactions/7710196AF58BF63B1260E6B999C0FDAAA032F059713CE46D1E6F39853523FA52/detailed
waiting for mint execution.............
successfully minted in tx 0x509de6a7dcc741814a11c51925b5947d3785655aac029ddb3cf829075d809bd7
https://coston2-explorer.flare.network/tx/0x509de6a7dcc741814a11c51925b5947d3785655aac029ddb3cf829075d809bd7?tab=logs

minted fassets, check here:
https://coston2-explorer.flare.network/address/0x0b6A3645c240605887a5532109323A3E12273dc7?tab=read_proxy

continue to deposit... press enter
sent instruction on underlying: CDB763ED1487DF49B1A6198BCBA919F9D1432EAA15D1A562F18C322137C52F65
https://testnet.xrpl.org/transactions/CDB763ED1487DF49B1A6198BCBA919F9D1432EAA15D1A562F18C322137C52F65/detailed

waiting to bridge.............
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0x84f9ae36727feadc4c113f74cdb221b140682c2c79d8ced495c457a43ac218d8
https://coston2-explorer.flare.network/tx/0x84f9ae36727feadc4c113f74cdb221b140682c2c79d8ced495c457a43ac218d8?tab=logs

deposited into vault, check here:
https://coston2-explorer.flare.network/address/0x912DbF2173bD48ec0848357a128652D4c0fc33EB?tab=read_contract

continue to withdraw... press enter
sent instruction on underlying: 51145A98CB7217499D8C80C13EB6BCC631D1184BE24E3E6B25E1C1B1A556B477
https://testnet.xrpl.org/transactions/51145A98CB7217499D8C80C13EB6BCC631D1184BE24E3E6B25E1C1B1A556B477/detailed

waiting to bridge............
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0x427bd56f04967580557a8be5eaa7edaa14c7f846a367cfdb54dedde11e42962b
https://coston2-explorer.flare.network/tx/0x427bd56f04967580557a8be5eaa7edaa14c7f846a367cfdb54dedde11e42962b?tab=logs

sent instruction on underlying: 45E68D1B9EDB81B74765E23C342B148F7386B7DB3079C5D20DB85BCCC605B5ED
https://testnet.xrpl.org/transactions/45E68D1B9EDB81B74765E23C342B148F7386B7DB3079C5D20DB85BCCC605B5ED/detailed

waiting to bridge...............
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0xd82daff2fe59fe083d7d2481ef5ab216dfe59d6832526fe9c2218f19074d32d4
https://coston2-explorer.flare.network/tx/0xd82daff2fe59fe083d7d2481ef5ab216dfe59d6832526fe9c2218f19074d32d4?tab=logs

withdrawn from vault, check here:
https://coston2-explorer.flare.network/address/0x912DbF2173bD48ec0848357a128652D4c0fc33EB?tab=read_contract

continue to redeem... press enter
sent instruction on underlying: E4C383DDE924AF03BA13A8199EA8C9DC7CA9012D4666D43CC6E0245F64402F3B
https://testnet.xrpl.org/transactions/E4C383DDE924AF03BA13A8199EA8C9DC7CA9012D4666D43CC6E0245F64402F3B/detailed

waiting to bridge..............
BRIDGED FOR 0xF4CC61CCCDA8b792EAA112455D9DBc4bcb9AA9A0
successfully bridged in tx 0xff80b1da1581304a2e9584159966ad231bc3352275fcad639d6130e905217213
https://coston2-explorer.flare.network/tx/0xff80b1da1581304a2e9584159966ad231bc3352275fcad639d6130e905217213?tab=logs

```

</details>
Loading