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
- Mainnet FantomPool Proxy — 0x84db6eE82b7Cf3b47E8F19270abdE5718B936670 (opens in a new tab)
- Testnet FantomPool Proxy — 0x7B72E8117E69951F1b00178016EEaEE4ce715f28 (opens in a new tab)
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
- Mainnet FantomPool Proxy — 0x84db6eE82b7Cf3b47E8F19270abdE5718B936670 (opens in a new tab)
- Testnet FantomPool Proxy — 0x7B72E8117E69951F1b00178016EEaEE4ce715f28 (opens in a new tab)
Example
- Mainnet live transaction example (opens in a new tab)
- Testnet live transaction example (opens in a new tab)
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 is0xCfC785741Dc0e98ad4c9F6394Bb9d43Cd1eF5179
.
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.