Skip to content

Conversation

@AmadiaFlare
Copy link
Collaborator

Adds docs and examples for FAsset auto-redemption.

@AmadiaFlare AmadiaFlare requested a review from fassko November 26, 2025 06:48
@fassko
Copy link
Collaborator

fassko commented Dec 11, 2025

@AmadiaFlare please make a new section Layer Zero or Cross Chain in docs/fassets/developer-guides.mdx to have this guide when users click on Developer Guides.

Copy link
Collaborator

@fassko fassko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added bunch of comments, let's dicuss.

Comment on lines 25 to 27
- Bridge FXRP tokens from Coston2 to Hyperliquid EVM to prepare for auto-redemption
- Send FXRP from Hyperliquid back to Coston2 and auto-redeem to native XRP
- Execute the entire bridge-and-redeem flow with just one transaction
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- Bridge FXRP tokens from Coston2 to Hyperliquid EVM to prepare for auto-redemption
- Send FXRP from Hyperliquid back to Coston2 and auto-redeem to native XRP
- Execute the entire bridge-and-redeem flow with just one transaction
- Bridge FXRP tokens from Flare Testnet Coston2 to Hyperliquid EVM to prepare for auto-redemption.
- Send FXRP from Hyperliquid back to Flare Testnet Coston2 and auto-redeem to native XRP.
- Execute the entire bridge-and-redeem flow with just one transaction.


## Introduction

This documentation covers a cross-chain bridge system that allows you to move FAssets (tokenized versions of non-smart contract tokens like XRP) between Flare Network's Coston2 testnet and Hyperliquid EVM Testnet.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
This documentation covers a cross-chain bridge system that allows you to move FAssets (tokenized versions of non-smart contract tokens like XRP) between Flare Network's Coston2 testnet and Hyperliquid EVM Testnet.
This documentation covers a cross-chain bridge system that allows you to move FAssets (tokenized versions of non-smart contract tokens like XRP) between Flare Testnet Coston2 and Hyperliquid EVM Testnet.

Comment on lines 31 to 33
- LayerZero OFT (Omnichain Fungible Token) for cross-chain messaging
- Flare's FAsset system for tokenizing non-smart contract assets
- Composer pattern for automatic execution on the destination chain
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Suggested change
- LayerZero OFT (Omnichain Fungible Token) for cross-chain messaging
- Flare's FAsset system for tokenizing non-smart contract assets
- Composer pattern for automatic execution on the destination chain
- LayerZero OFT (Omnichain Fungible Token) for cross-chain messaging.
- Flare's [FAsset](/fassets/overview) system for tokenizing non-smart contract assets.
- Composer pattern for automatic execution on the destination chain.
  • Add link to LayerZero OFT to LayerZero docs.
  • Is it LayerZero composer, needs a bit more explanation what is it.

**IMPORTANT:** To successfully test the auto-redemption feature, you must run the scripts in the correct order:

### Step 1: Bridge FXRP to Hyperliquid EVM (Required First)

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I think it makes sense to explain briefly what is OFT how it moves tokens.

Run `bridgeToHyperEVM.ts` on **Coston2** network to transfer your FXRP tokens from Coston2 to Hyperliquid EVM Testnet.
This script does NOT involve auto-redemption - it simply moves your tokens to Hyperliquid where you can use them to prepare for the auto-redemption process.

**Why this is required:** You need FXRP tokens on Hyperliquid EVM before you can test the auto-redeem functionality.
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Put this in info block

:::info

:::

Comment on lines +179 to +180
composeMsg: "0x",
oftCmd: "0x",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Why these are 0x values? Add a comment

Comment on lines +26 to +44
function getAllV2TestnetEndpoints(): { name: string; eid: number }[] {
const endpoints: { name: string; eid: number }[] = [];

for (const [key, value] of Object.entries(EndpointId)) {
// Only include V2 testnet endpoints (they end with _V2_TESTNET and have numeric values)
if (key.endsWith("_V2_TESTNET") && typeof value === "number") {
// Convert key like "SEPOLIA_V2_TESTNET" to "Sepolia"
const name = key
.replace("_V2_TESTNET", "")
.split("_")
.map((word) => word.charAt(0) + word.slice(1).toLowerCase())
.join(" ");
endpoints.push({ name, eid: value });
}
}

// Sort by EID for consistent output
return endpoints.sort((a, b) => a.eid - b.eid);
}
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

If you use higher order function then there is no need to define empty array.

Suggested change
function getAllV2TestnetEndpoints(): { name: string; eid: number }[] {
const endpoints: { name: string; eid: number }[] = [];
for (const [key, value] of Object.entries(EndpointId)) {
// Only include V2 testnet endpoints (they end with _V2_TESTNET and have numeric values)
if (key.endsWith("_V2_TESTNET") && typeof value === "number") {
// Convert key like "SEPOLIA_V2_TESTNET" to "Sepolia"
const name = key
.replace("_V2_TESTNET", "")
.split("_")
.map((word) => word.charAt(0) + word.slice(1).toLowerCase())
.join(" ");
endpoints.push({ name, eid: value });
}
}
// Sort by EID for consistent output
return endpoints.sort((a, b) => a.eid - b.eid);
}
function getAllV2TestnetEndpoints(): { name: string; eid: number }[] {
return Object.entries(EndpointId)
.filter(([key, value]) => key.endsWith("_V2_TESTNET") && typeof value === "number")
.map(([key, eid]) => ({
name: key
.replace("_V2_TESTNET", "")
.split("_")
.map(w => w.charAt(0) + w.slice(1).toLowerCase())
.join(" "),
eid,
}))
.sort((a, b) => a.eid - b.eid);
}


for (const endpoint of V2_TESTNET_ENDPOINTS) {
try {
const peer = await oftAdapter.methods.peers(endpoint.eid).call();
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Similar here , can convert to higher order function.

Copy link
Collaborator

@fassko fassko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I added bunch of comments, let's dicuss.

dineshpinto
dineshpinto previously approved these changes Dec 16, 2025
Copy link
Collaborator

@fassko fassko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style improvements and lot calculation


Once you have FXRP tokens on Hyperliquid (from Step 1), run `autoRedeemHyperEVM.ts` on **Hyperliquid Testnet** network to send them back to Coston2 with automatic redemption to native XRP.
This is the auto-redemption feature that converts FXRP back to native XRP in a single transaction.

Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

OK if the same private key works, then it is all good.

Copy link
Collaborator

@fassko fassko left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Style improvements

@dineshpinto dineshpinto merged commit a27c2e9 into main Dec 18, 2025
14 checks passed
@dineshpinto dineshpinto deleted the fassets/autoredeem branch December 18, 2025 13:12
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

4 participants