|
| 1 | +--- |
| 2 | +title: Get FXRP Address |
| 3 | +tags: [intermediate, fassets] |
| 4 | +slug: fassets-fxrp-address |
| 5 | +description: Learn how to get FXRP address for interacting with the FAssets system |
| 6 | +keywords: [fassets, flare-network, fxrp, asset-manager] |
| 7 | +sidebar_position: 6 |
| 8 | +--- |
| 9 | + |
| 10 | +import CodeBlock from "@theme/CodeBlock"; |
| 11 | +import Remix from "@site/src/components/remix"; |
| 12 | +import FAssetsSwapAndRedeemContract from "!!raw-loader!/examples/developer-hub-solidity/FAssetsSwapAndRedeem.sol"; |
| 13 | +import FAssetsGetFxrpScript from "!!raw-loader!/examples/developer-hub-javascript/fassets_get_fxrp.ts"; |
| 14 | +import RedemptionProcessPrerequisites from "./_redemption_process_prerequisites.mdx"; |
| 15 | + |
| 16 | +## Overview |
| 17 | + |
| 18 | +In this guide, you will learn how to get the [FXRP](/fassets/reference) address for the FAssets system. |
| 19 | +FXRP is the ERC-20 representation of XRP on the Flare network, enabling you to use XRP in smart contracts and DeFi applications. |
| 20 | + |
| 21 | +## Prerequisites |
| 22 | + |
| 23 | +Before you begin, make sure you have: |
| 24 | + |
| 25 | +- [Flare Hardhat Starter Kit](/network/guides/hardhat-foundry-starter-kit) installed and configured. |
| 26 | +- [Flare Network Periphery Contracts](https://www.npmjs.com/package/@flarenetwork/flare-periphery-contracts) installed in your project. |
| 27 | +- Basic understanding of [FAssets](/fassets/overview) and how they work. |
| 28 | + |
| 29 | +## Understanding FXRP Address |
| 30 | + |
| 31 | +The FXRP address is the contract address of the [ERC-20 token](https://ethereum.org/en/developers/docs/standards/tokens/erc-20/) that represents XRP on the Flare network and is essential for: |
| 32 | + |
| 33 | +- Interacting with FXRP in smart contracts. |
| 34 | +- Transferring FXRP tokens. |
| 35 | +- Participating in DeFi protocols that use FXRP. |
| 36 | + |
| 37 | +## Getting the FXRP Address |
| 38 | + |
| 39 | +To get the FXRP address, you need to interact with the `AssetManager` contract using the [`IAssetManager`](/fassets/reference/IAssetManager) interface and call the [`fAsset`](/fassets/reference/IAssetManager#fasset) function. |
| 40 | +This function returns the address of the FAsset token contract (ERC-20) that is managed by this asset manager instance. |
| 41 | + |
| 42 | +### Script Code |
| 43 | + |
| 44 | +The following TypeScript script demonstrates how to retrieve the FXRP address: |
| 45 | + |
| 46 | +<CodeBlock language="javascript" title="scripts/fassets/getFXRP.ts"> |
| 47 | + {FAssetsGetFxrpScript} |
| 48 | +</CodeBlock> |
| 49 | + |
| 50 | +### Code Explanation |
| 51 | + |
| 52 | +The script: |
| 53 | + |
| 54 | +1. Connects to the `AssetManager` contract using the [`IAssetManager`](/fassets/reference/IAssetManager) interface. |
| 55 | +2. Calls the [`fAsset()`](/fassets/reference/IAssetManager#fasset) function to get the FXRP token address. |
| 56 | +3. Logs the address to the console. |
| 57 | + |
| 58 | +### Run the Script |
| 59 | + |
| 60 | +To run the script, use the following command: |
| 61 | + |
| 62 | +```bash |
| 63 | +yarn hardhat run scripts/fassets/getFXRP.ts --network coston2 |
| 64 | +``` |
| 65 | + |
| 66 | +The script will output the FXRP address for the FAssets system on the Coston2 network: |
| 67 | + |
| 68 | +```bash |
| 69 | +FXRP address 0x8b4abA9C4BD7DD961659b02129beE20c6286e17F |
| 70 | +``` |
| 71 | + |
| 72 | +:::note Network Addresses |
| 73 | +The FXRP address will be different depending on which network you are using. |
| 74 | +::: |
| 75 | + |
| 76 | +## Using the FXRP Address |
| 77 | + |
| 78 | +Once you have the FXRP address, you can: |
| 79 | + |
| 80 | +1. Use it in your smart contracts to interact with FXRP |
| 81 | +2. Add it to your wallet to track FXRP balances |
| 82 | +3. Use it in DeFi protocols that support FXRP |
| 83 | + |
| 84 | +:::tip Next Steps |
| 85 | + |
| 86 | +In this guide, you learned how to get the FXRP address for the FAssets system by interacting with the `AssetManager` contract using the [`IAssetManager`](/fassets/reference/IAssetManager) interface. |
| 87 | + |
| 88 | +To continue your FAssets development journey, you can: |
| 89 | + |
| 90 | +- Learn how to [mint FXRP](/fassets/developer-guides/fassets-mint). |
| 91 | +- Understand how to [redeem FXRP](/fassets/developer-guides/fassets-redeem). |
| 92 | +- Explore [FAssets system settings](/fassets/operational-parameters). |
| 93 | +- Check the [lot size](/fassets/developer-guides/fassets-settings-node) for FXRP operations. |
| 94 | + |
| 95 | +::: |
0 commit comments