3.8 KiB
3.8 KiB
CCIP Fee Structure Documentation
Date: 2025-01-12
Network: ChainID 138
Overview
This document describes the fee structure and payment mechanism for CCIP (Cross-Chain Interoperability Protocol) transactions.
Fee Configuration
Fee Token
- Token Address:
0x514910771AF9Ca656af840dff83E8264EcF986CA(LINK) - Network: ChainID 138
- Purpose: Payment token for CCIP fees
Fee Structure
Base Fee
- Amount: 1000000000000000 wei (0.001 LINK)
- Purpose: Base fee for all CCIP messages
- Applies To: All cross-chain messages
Data Fee Per Byte
- Amount: 100000000 wei (0.0000001 LINK per byte)
- Purpose: Fee for message data size
- Calculation:
dataFee = dataSize * dataFeePerByte
Total Fee Calculation
totalFee = baseFee + (dataSize * dataFeePerByte)
Fee Payment Mechanism
Payment Method
Fees are paid in LINK tokens (not native ETH).
Fee Payment Process
-
User Initiates Transfer:
- User calls bridge contract
- Bridge contract calculates fee
- Bridge contract checks LINK balance
-
Fee Payment:
- Bridge contract transfers LINK to Router
- Router processes payment
- Message is sent
-
Fee Verification:
- Router verifies fee payment
- Message is queued for processing
- Oracle network processes message
Fee Calculation
Current Status: ⚠️ Failing
Fee calculation in scripts is currently failing. This may be due to:
- Router contract not exposing
getFee()function - Fee calculation requiring different parameters
- Fee calculation handled by separate contract
Verification
Script: scripts/verify-fee-calculation.sh
Usage:
./scripts/verify-fee-calculation.sh [amount_eth] [destination_selector]
Example:
./scripts/verify-fee-calculation.sh 0.001 5009297550715157269
LINK Token Requirements
LINK Token Balance
Bridge contracts need LINK tokens to pay fees:
- Minimum Balance: Enough to cover expected fees
- Recommended: Buffer for multiple transactions
Checking LINK Balance
cast call 0x514910771AF9Ca656af840dff83E8264EcF986CA \
"balanceOf(address)" \
<bridge_address> \
--rpc-url <rpc_url>
Acquiring LINK Tokens
- Purchase: Buy LINK tokens on exchange
- Transfer: Send LINK to bridge contract
- Faucet: Use testnet faucet (if available)
Fee Estimation
Estimating Fees
For a typical cross-chain transfer:
- Base Fee: 0.001 LINK
- Data Fee: ~0.0001 LINK (depends on message size)
- Total: ~0.0011 LINK per transfer
Factors Affecting Fees
- Message Size: Larger messages = higher fees
- Destination Chain: Different chains may have different fees
- Network Conditions: Fees may vary with network load
Fee Optimization
Strategies
- Batch Transfers: Combine multiple transfers to reduce per-transfer fees
- Optimize Message Size: Minimize data in messages
- Monitor Fees: Track fee trends and optimize timing
Cost Analysis
- Per Transfer: ~0.001 LINK
- Monthly (100 transfers): ~0.1 LINK
- Annual (1000 transfers): ~1 LINK
Troubleshooting
Fee Calculation Failing
Symptoms:
- Scripts cannot calculate fees
getFee()returns 0 or fails
Solutions:
- Verify Router contract address
- Check function availability
- Verify LINK token configuration
Insufficient LINK Balance
Symptoms:
- Transactions failing with insufficient balance
- Fee payment errors
Solutions:
- Check LINK balance
- Transfer LINK to bridge contract
- Verify LINK token address
Related Documentation
Last Updated: 2025-01-12