BitFi Docs
Home
  • Welcome to BitFi
    • CeDeFi Innovation
    • Addressing Market Challenges
  • FAQ
  • Background
    • Bitcoin-Fi: Current Challenges
    • The BitFi Solution: A CeDeFi Hybrid Approach
  • BitFi‘s CEDEFI
    • Integration with CeFi and DeFi
    • Implementation of CeFi
      • Ceffu MirrorX
      • BitFi Strategies
      • Risk Management
    • Implementation of DeFi
      • bfBTC
      • bfUSD
  • How To
    • Introduction
    • Stake BTC on an EVM-Compatible Chain
    • Stake BTC on Bitcoin Network
    • Unstake bfBTC to EVM-Compatibale Chain
    • Unstake bfBTC to Bitcoin Network
  • Developer
    • bfBTC Overview
    • Using Contract
      • Stake bfBTC
      • Unstake bfBTC
      • bfBTC Fees
      • bfBTC Price Oracle
    • Epoch and Ratio
      • Epoch Updates
      • Underlying Asset Price Variation
    • Deployed Contracts
    • Audit Report
  • Resource
    • Communities
    • Brand Kit
    • BitFi Home Page
Powered by GitBook
On this page
  • Fee Types
  • Fee Structure
  • Fee Calculation
  • Fee Events
  • Additional Information
  1. Developer
  2. Using Contract

bfBTC Fees

Note: fees only be taken while requestWithdraw , requestWithdrawNative, and cross-chain actions.

Fee Types

uint8 private constant FEE_TYPE_EVM = 0;      // For EVM chain operations
uint8 private constant FEE_TYPE_NATIVE = 1;   // For native chain [Bitcoin] operations
uint8 private constant FEE_TYPE_CROSSCHAIN = 2; // For cross-chain operations

Fee Structure

struct FeeConfig {
    uint128 percentageFee; // Percentage-based fee (precision: 100000)
    uint128 fixedFee;      // Fixed fee amount
}

Fee Calculation

function calculateFee(
    address user,
    uint256 amount,
    uint8 feeType
) public view returns (uint256 percentageFee, uint256 fixedFee)

Description: Calculate fees for a specific operation based on user address and amount.

Parameters:

  • user: Address of the user performing the operation

  • amount: Amount of the operation

  • feeType: Type of fee to calculate (EVM/Native/Crosschain)

Return Values:

  • percentageFee: Calculated percentage-based fee

  • fixedFee: Fixed fee amount

Calculation Formula:

totalFee=percentageFee+fixedFee \text{totalFee} = \text{percentageFee} + \text{fixedFee} totalFee=percentageFee+fixedFee

Notes:

  • percentageFee precision is 100000

  • Transaction reverts if total fee exceeds operation amount

Fee Events

event FeeUpdated(uint8 indexed feeType, uint256 percentageFee, uint256 fixedFee);
event FeeWhitelistUpdated(address indexed account, bool status);
event FeeCollected(
    address indexed user,
    uint8 indexed feeType,
    uint256 id,
    uint256 amount,
    uint256 percentageFee,
    uint256 fixedFee
);

Additional Information

  • Fees are collected in the native token of the operation

  • Fee collection is automatic and transparent

  • Fee events provide tracking and auditing capabilities

  • Whitelist mechanism allows for special cases and promotions

  • Fee configuration can be updated based on market conditions

PreviousUnstake bfBTCNextbfBTC Price Oracle

Last updated 2 months ago