Deposit bfBTC

Preview Deposit

Call previewDeposit(uint256 amount) to preview the amount of bfBTC received for a specified BTC deposit amount.

  • amount: The expected amount of BTC to deposit.

  • Return Value: The estimated amount of bfBTC to be received.

  • Calculation Formula: amount * btcPrice * currentRatio / PRICE_PRECISION / (10 ** underlyingDecimals) This function helps estimate bfBTC received before depositing, facilitating minAmount setting in the deposit function.

Notes:

  • underlyingDecimals = 8 (Bitcoin token precision).

  • minAmount is similar to slippage. To prevent deposit failures due to epoch updates, a 1% buffer is recommended.

Deposit on EVM

Call deposit(uint256 amount, uint256 minAmount)

  • Requires prior approval for the contract to use your underlying token (BTCB or WBTC). On Ethereum, this is WBTC; on BSC, it's BTCB. The underlying asset may vary on other EVM-compatible chains (e.g., Bitlayer uses its native token as the deposit asset).

  • amount: The deposit amount.

  • minAmount: The minimum acceptable amount of bfBTC to be minted (recommended: 1%, similar to swap slippage).

  • Depositing yields the corresponding amount of bfBTC tokens.

Notes:

  • On Bitlayer, amount is not required; the desired deposit amount is passed in the transaction's value.

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

Recv=DepositAmountmin(1,OraclePrice1e6)Ratio1e8Recv = \text{DepositAmount} * \min\left(1, \frac{\text{OraclePrice}}{1e6}\right) * \frac{\text{Ratio}}{1e8}

Recv: Amount of bfBTC received (8 decimals).

DepositAmount: Amount of WBTC deposited (8 decimals).

OraclePrice: WBTC/BTC price from the oracle.

Ratio: Exchange ratio between BTC and bfBTC.

Deposit on BTC

Native BTC Deposit:

The depositNative() function can only be called by a multisig. Assets deposited in BTC on the Bitcoin network are confirmed by the multisig wallet before this function is called to mint bfBTC.

Last updated