• Ankr Staking
  • For Integrators
  • Smart Contract API
  • Binance Liquid Staking API

BNB Liquid Staking API

To integrate with BNB Liquid Staking, use the smart contract functions and examples below.

Switch aBNBb to aBNBc

unlockShares(shares)

Switches aBNBb to aBNBc.

Parameters

shares (uint256, required) — amount of aBNBb to be switched to aBNBc.

Smart contract

Mainnet aBNBb Proxy

Example

Mainnet live transaction example

Switch aBNBc to aBNBb

approve(spender, amount)

Lets the aBNBb smart contract transfer user's liquid tokens.

Parameters
  • spender (address, required) — address of the BinancePool contract.
  • amount (uint256, required) — amount of aBNBc to be switched to aBNBb.
Smart contract

Mainnet aBNBc Proxy

Example

Live transaction example

lockShares(shares)

Switches aBNBc to aBNBb.

Parameters

shares (uint256, required) — amount of aBNBc to be switched to aBNBb.

Smart contract

Mainnet aBNBb Proxy

Example

Mainnet live transaction example

Stake BNB and claim aBNBb

stakeAndClaimBonds(payableAmount)

Stakes BNB and claims aBNBb for the staked BNB.

Parameters

payableAmount (BNB, required) — amount of BNB to be staked.

Smart contract

Mainnet BinancePool Proxy

Example

Mainnet live transaction example

Stake BNB and claim aBNBc

stakeAndClaimCerts(payableAmount)

Stakes BNB and claims aBNBc for the staked BNB.

Parameters

payableAmount (BNB, required) — amount of BNB to be staked.

Smart contract

Mainnet BinancePool Proxy

Example

Mainnet live transaction example

Unstake aBNBb and get BNB

unstakeBonds(amount)

Unstakes aBNBb and gets BNB for the unstaked aBNBb.

Parameters

amount (uint256, required) — amount of aBNBb to be unstaked.

Smart contract
Example

Unstake aBNBc and get BNB

approve(spender, rawAmount)

Lets the aBNBb smart contract transfer user's aBNBc tokens.

Parameters
  • spender (address, required) — address of the aBNBbsmart contract.
  • rawAmount (uint256, required) - amount of aBNBc to be unstaked.
Smart contract
Example

unstakeCerts(shares)

Unstakes aBNBc and gets BNB for the unstaked aBNBc.

Parameters

shares (uint256, required) — amount of aBNBc to be unstaked.

Smart contract
Example

Get APR

averagePercentageRate(uint256 day)

Gets the APR for aBNBb or aBNBc.

The formula is best expressed by an example.

With 3 provided as the depth, the APR = ((((day 3 - day 2) / day 3) * 100) + ((day 2 - day 1) / day 2) * 100) + ((day 1 - current day) / day 1) * 100) / 3) * 365.

Parameters
  • day (uint256, required) — number of days to get the APR for. Max value — 7 days.
Smart contract
Example

averagePercentageRate being a read function, we suggest you visit the links and make a query entering a desired number of days to see an example.

Get staking metrics

To integrate Ankr Staking metrics into your dashboards or use metrics like APY in your products, read Liquid Staking Metrics.