Stake bfBTC
Currently, we support RedStone Oracle for price feeds. BitFi plans to integrate more underlying asset oracles in the future.
Preview Stake
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, facilitatingminAmount
setting in thedeposit
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.
Stake 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'svalue
.On Ethereum, when depositing WBTC, the actual deposit amount is calculated using the Oracle's WBTC/BTC price:
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.
Stake on BTC
Native BTC Stake:
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