Withdraw bfBTC

Withdraw to EVM

  1. Call requestWithdraw(uint256 amount)

  • amount: The amount of bfBTC to withdraw.

  • This transfers your bfBTC to the contract; bfBTC is not yet burned.

  1. Await Administrator Approval

  • The administrator calls approveWithdraw() to approve the withdrawal request.

  • A cooldown period (currently 1 epoch) is required before approval.

  1. Call claim(uint256 withdrawId) to receive BTC

  • withdrawId: The withdrawal request ID.

  • Use claimable() to check the claimable amount.

  • Successfully claiming yields the underlying token (BTC).

Notes:

  • Order Status

Order status typically transitions:

Pending -> Approved -> Claimed.

On Bitlayer:

Pending -> Approved -> Unbound -> Claimed.

On Bitlayer, after approval, funds must be transferred via the bridge to the contract before the status changes to Unbound, allowing the user to claim funds.

  • Withdrawal approval time may vary depending on Ceffu's processing speed. BitFi aims to process withdrawals within 3 epochs.

  • On Ethereum, when withdrawing WBTC, the actual withdrawal amount is calculated using the Chainlink Oracle's WBTC/BTC price:

Recv: Amount of WBTC received (8 decimals).

WithdrawAmount: Amount of bfBTC withdrawn (8 decimals).

OraclePrice: WBTC/BTC price from the oracle.

Ratio: Exchange ratio between BTC and bfBTC.

Withdraw to BTC

  1. Call requestWithdrawNative(uint256 amount, uint8 btcAddressType, bytes32 btcAddress)

  • amount: The amount of bfBTC to withdraw.

  • btcAddressType: BTC address type (1-4).

  • btcAddress: The receiving BTC address.

  1. Await Administrator Processing

  • The administrator calls nativeWithdraw() to process the withdrawal request, sending BTC to the specified address.

Important Notes

  • Deposits and withdrawals must be made while the contract is not paused.

  • Withdrawals require a cooldown period. (1 epoch)

  • The actual amount of BTC received depends on the current epoch's ratio and price.

  • The displayed amount on the Bitcoin network may differ.

  • Withdrawal approval time may vary depending on Ceffu's processing speed. BitFi aims to process withdrawals within 3 epochs.

Last updated