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:
- Flare Hardhat Starter Kit installed and configured.
- Flare Network Periphery Contracts installed in your project.
- Basic understanding of FAssets and how they work.
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:
// 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:
- Connects to the
AssetManager
contract using theIAssetManager
interface. - Calls the
fAsset()
function to get the FXRP token address. - 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
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:
- Use it in your smart contracts to interact with FXRP
- Add it to your wallet to track FXRP balances
- Use it in DeFi protocols that support FXRP
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:
- Learn how to mint FXRP.
- Understand how to redeem FXRP.
- Explore FAssets system settings.
- Check the lot size for FXRP operations.