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
- BNBStakingPool (opens in a new tab) (0x9e347Af362059bf2E55839002c699F7A5BaFE86E)
- ankrBNB (opens in a new tab) (0x52F24a5e03aee338Da5fd9Df68D2b6FAe1178827)
Testnet
- BNBStakingPool (opens in a new tab) (0x0eCf14f54C5fF190e025Bc5e80c6351F91BFcB1c)
- ankrBNB (opens in a new tab) (0x3C1039C346bd5141BF2D5e855928E61655658fA7)
Functions
BNBStakingPool.getMinUnstake()
Get the minimum unstake value.
Addresses
- Mainnet (opens in a new tab) (0x9e347Af362059bf2E55839002c699F7A5BaFE86E)
- Testent (opens in a new tab) (0x0eCf14f54C5fF190e025Bc5e80c6351F91BFcB1c)
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
- Mainnet (opens in a new tab) (0x9e347Af362059bf2E55839002c699F7A5BaFE86E)
- Testent (opens in a new tab) (0x0eCf14f54C5fF190e025Bc5e80c6351F91BFcB1c)
await BNBStakingPool.getFlashUnstakeFee()
Get the flash unstake fee.
Addresses
- Mainnet (opens in a new tab) (0x9e347Af362059bf2E55839002c699F7A5BaFE86E)
- Testent (opens in a new tab) (0x0eCf14f54C5fF190e025Bc5e80c6351F91BFcB1c)
await BNBStakingPool.getFlashPoolCapacity()
Get the current flash pool capacity.
Addresses
- Mainnet (opens in a new tab) (0x9e347Af362059bf2E55839002c699F7A5BaFE86E)
- Testent (opens in a new tab) (0x0eCf14f54C5fF190e025Bc5e80c6351F91BFcB1c)
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
- Mainnet (opens in a new tab) (0x9e347Af362059bf2E55839002c699F7A5BaFE86E)
- Testent (opens in a new tab) (0x0eCf14f54C5fF190e025Bc5e80c6351F91BFcB1c)