Skip to main content

Get FXRP Address

Overview

In this guide, you will learn how to get the FXRP address for the FAssets system. FXRP is the ERC-20 representation of XRP on the Flare network, enabling you to use XRP in smart contracts and DeFi applications.

Prerequisites

Before you begin, make sure you have:

Understanding FXRP Address

The FXRP address is the contract address of the ERC-20 token that represents XRP on the Flare network and is essential for:

  • Interacting with FXRP in smart contracts.
  • Transferring FXRP tokens.
  • Participating in DeFi protocols that use FXRP.

Getting the FXRP Address

To get the FXRP address, you need to interact with the AssetManager contract using the IAssetManager interface and call the fAsset function. This function returns the address of the FAsset token contract (ERC-20) that is managed by this asset manager instance.

Script Code

The following TypeScript script demonstrates how to retrieve the FXRP address:

scripts/fassets/getFXRP.ts
// yarn hardhat run scripts/fassets/getFXRP.ts --network coston2

// AssetManager address on Flare Testnet Coston2 network
const ASSET_MANAGER_ADDRESS = "0xDeD50DA9C3492Bee44560a4B35cFe0e778F41eC5";

const IAssetManager = artifacts.require("IAssetManager");

async function main() {
const assetManager = await IAssetManager.at(ASSET_MANAGER_ADDRESS);
const fasset = await assetManager.fAsset();

console.log("FXRP address", fasset);
}

main().catch((error) => {
console.error(error);
process.exitCode = 1;
});

Code Explanation

The script:

  1. Connects to the AssetManager contract using the IAssetManager interface.
  2. Calls the fAsset() function to get the FXRP token address.
  3. Logs the address to the console.

Run the Script

To run the script, use the following command:

yarn hardhat run scripts/fassets/getFXRP.ts --network coston2

The script will output the FXRP address for the FAssets system on the Coston2 network:

FXRP address 0x8b4abA9C4BD7DD961659b02129beE20c6286e17F
Network Addresses

The FXRP address will be different depending on which network you are using.

Using the FXRP Address

Once you have the FXRP address, you can:

  1. Use it in your smart contracts to interact with FXRP
  2. Add it to your wallet to track FXRP balances
  3. Use it in DeFi protocols that support FXRP
Next Steps

In this guide, you learned how to get the FXRP address for the FAssets system by interacting with the AssetManager contract using the IAssetManager interface.

To continue your FAssets development journey, you can: