For Developers
Smart Contract API
Fantom Liquid Staking API

FTM Liquid Staking API

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

Stake FTM and claim ankrFTM

stakeAndClaimCerts()

Stakes the msg.value of FTM and claims ankrFTM for it.

Smart contract
Example

Unstake ankrFTM and claim FTM

burnCerts(amount)

Burns ankrFTM and gets FTM for the burned ankrFTM.

Parameters

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

Smart contract
Example

Get APR

averagePercentageRate(uint256 day, address addr)

Gets the APR for ankrFTM.

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.
  • address (address, required) — address of the token contract. The address of ankrFTM is 0xCfC785741Dc0e98ad4c9F6394Bb9d43Cd1eF5179.
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.