ZealynxSecurity / solana-LzApp-ONFT

0 stars 0 forks source link

[I-01] The Protocol Does Not Charge Fee for Cross Chain Token Transfers and Messages #9

Open ShieldifyMartin opened 1 month ago

ShieldifyMartin commented 1 month ago

Description

The current implementation allows users to send and receive cross-chain tokens and messages without incurring any transaction fees. While this might seem user-friendly, it can potentially lead to economic inefficiencies and discourage protocol sustainability. Charging a fee for cross-chain transactions is a common practice in many decentralized protocols to cover operational costs and prevent abuse.

Recommendation

Introduce a fee mechanism in the ONFT protocol by adding a fee variable to the onft_config. Implement a fee percentage that is deducted before tokens are sent across chains. This will ensure that the sender contributes to network maintenance and helps mitigate spam or abusive transactions.

Example Code:

Add a fee field in onft_config:

pub struct ONftConfig {
    // immutable
    pub ld2sd_rate: u64,
    pub token_mint: Pubkey,
    pub token_program: Pubkey,
    pub endpoint_program: Pubkey,
    pub bump: u8,
    // mutable
    pub admin: Pubkey,
    pub ext: ONftConfigExt,
+    pub fee_percentage: u64, // Fee as a percentage (e.g., 1 for 1%)
}