FAssets Cycle
In this guide, we will walk you through all aspects of the FAssets process. We will start with an account on XRPL, we will send its assets to Flare, and then return them to XRPL. The steps we will take will be as follows:
mint: convert XRP to FXRPdeposit: deposit FXRP to the Firelight vaultwithdraw: withdraw FXRP from the Firelight vaultredeem: convert FXRP back to XRP
We will do all of that through the Flare Smart Accounts CLI. The CLI allows us to make XRPL transactions through terminal commands.
The idea behind the Flare Smart Accounts is that we perform actions on the Flare chain through instructions sent on XRPL.
Mint
First, we mint FXRP by reserving the necessary collateral and then sending XRP to the agent's underlying address.
We will mint 1 lot of FXRP, with the agent at the address 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC.
The CLI command that does this is:
./smart_accounts.py bridge mint --agent-address 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC --lots 1
Expected output
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
The CLI sends both the reserveCollateral instruction and the Payment transaction to the agent's underlying address.
Deposit
Next, we deposit 1 FXRP into the Firelight vault, specified by the MasterAccountController contract.
Here, the CLI sends the deposit instruction.
The command is:
./smart_accounts.py bridge deposit --amount 1
Expected output
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
Withdraw
We withdraw the same number of tokens that we have just deposited from the Firelight vault.
The process involves two steps.
The CLI first sends the withdraw instruction, and afterwards, the claimWithdraw.
The first instruction starts the withdrawal process, and the second claims the FXRP once it is released.
We use the command:
./smart_accounts.py bridge withdraw --amount 1
Expected output
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
Redeem
The last step is to convert FXRP back to XRP.
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.
./smart_accounts.py bridge redeem --lots 1
Expected output
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
Simulation
The above cycle can be simulated with a single CLI command:
./smart_accounts.py debug simulation --agent-address 0x55c815260cBE6c45Fe5bFe5FF32E3C7D746f14dC --mint 1 --deposit 1
Expected output
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