For Developers
Flash Unstake
BNB Flash Unstake

BNB flash unstake

Ankr provides an additional opportunity to operate its LSTs by introducing a flash unstake feature. This feature significantly decreases the unstake time — the user receives their unstaked BNB in the same transaction. For this convenience, Ankr charges the user an additional flash unstake fee, subtracting it from the unstaked amount. Flash unstake is implemented via a pool — the same BNBStakingPool that provides functionality for Binance Liquid Staking.

Requirements

  • Min amount to unstake — 0.1 BNB.
  • Max amount to unstake — up to the capacity of the pool, as flash unstake is performed via a pool swap (ankrBNB to BNB).
  • Unbond time — none, the unstaked BNBs are instantly released to the user's address.
  • Splitting amounts larger than the pool capacity — not possible, the user will have to use the classic version of BNB unstake.

Smart contracts

  • BNBStakingPool — the main entry point to BNB Liquid Staking; stake, unstake, flash-unstake, etc.
  • ankrBNB (proxy) — the Liquid Staking token (ankrBNB) contract; mint or burn ankrBNB tokens for the user.

Addresses

Mainnet

Testnet

Functions

BNBStakingPool.getMinUnstake()

Get the minimum unstake value.

Addresses

ankrBNB.sharesToBonds(unit256 amount)

Get the initial amount of BNB (before the flash-unstake fee subtraction) for the user to receive when flash-unstaking. You can use it to calculate the final BNB amount, for example:

uint256 amount = ankrBNB.sharesToBonds(shares);
// calculate the amount of BNB with no flash unstake fee

uint256 unstakeFeeAmt = (amount * _flashUnstakeFee) / _FEE_MAX;
// Calculate the flash unstake fee; _FEE_MAX is 10000

amount -= unstakeFeeAmt;
// Calculate the final amount of BNB the user gets after the fee subtraction
Parameters

amount (uint256, required) — amount of ankrBNB to convert to BNB.

Addresses

await BNBStakingPool.getFlashUnstakeFee()

Get the flash unstake fee.

Addresses

await BNBStakingPool.getFlashPoolCapacity()

Get the current flash pool capacity.

Addresses

BNBStakingPool.swap(uint256 shares, address receiverAddress)

Perform a flash unstake. You can use it this way:

const tx = await BNBStakingPool.swap(uint256 shares, address receiverAddress);
Parameters
  • shares (uint256; required) — the amount of ankrBNB to flash unstake.
  • receiverAddress (address; required) — the user's address to release the unstaked BNB to.
Addresses