For Developers
Development Details
Polygon Liquid Staking

POL staking mechanics

POL Liquid Staking lets the user stake their funds through the corresponding smart contracts on Ethereum or a swap pool on Polygon, accumulate rewards, and receive their stake and rewards when unstaking.

Ankr principles for the staking are:

  • Make all staking transactions on the Ethereum or Polygon network.
  • On Ethereum, use classic Ankr Liquid Staking logic.
  • On Polygon, use a swap pool to perform a simple swap POL–ankrPOL–POL with a fixed price.
  • Accumulate and bridge together all the staked POL within Ankr.
  • Use the existing POL validator node owned by Ankr, thus there are no limits on staking amount and staking period.
  • Use a dynamic exchange ratio for ankrPOL to POL.
  • Recalculate ankrPOL/POL exchange ratio daily and update it in the ankrPOL smart contract.

The following explains staking requirements, fees, rewards, validators, smart contracts and function calls to interact with these smart contracts.

Requirements

The requirements when staking are:

  • Minimum value to stake — 1 POL.
  • Maximum value to stake:
    • On Ethereum — unlimited, at the user’s discretion.
    • On Polygon — limited by the swap pool's provider capacity. Current provider — Ankr itself.
  • Staking can be repeated anytime, without waiting for the current staking to complete.

The requirements when unstaking are:

  • Minimum value to unstake — 0 POL.
  • Maximum value to unstake:
  • On Ethereum — staked amount + % of the reward, up to the user’s balance.
  • On Polygon — limited by the swap pool's provider capacity. Current provider — Ankr itself. If max capacity is reached in an unstaking request, switch to classic unstake on Ethereum.
  • Withdrawal period after unstaking:
    • On Ethereum — >= 80 epochs. Typically, it’s around 1-2 days.
    • On Polygon — instantly.
  • ankrPOL to POL exchange ratio is dynamic, as ankrPOL grows in value to POL, daily.
  • User can unstake a part of or all the staked POL anytime.

Fees

When staking:

  • On Ethereum — a 5% technical service fee from the staking reward.
  • On Polygon — a 5% technical service fee from the staking reward.

When unstaking:

  • On Ethereum — no technical service.
  • On Polygon — a 0.5% technical service fee from the unstaked amount.

The user must also count in the gas price in ETH for outgoing transactions for staking/unstaking on Ethereum.

Rewards

User's ankrPOL value grows steadily to POL over time.

Validators receive rewards on the regular basis at the end of each epoch.

The APY is calculated from the validators' rewards.

Validators

There is a single Ankr validator on Polygon (opens in a new tab).

Smart contracts

Smart contracts involved in POL Liquid Staking on Ethereum are:

Smart contract code can be viewed by following the links and selecting the Contract tab.

Staking workflow

On Ethereum

The workflow is both user and Ankr-driven. The user part is Steps 1–2, the Ankr part is Steps 3–7.

User calls Pol::approve(address spender, uint256 amountToSpend) to approve the chosen POL amount to be sent to the PolygonPool smart contract.

User sends a request to Ankr PolygonPool smart contract on Ethereum, calling stakeAndClaimCerts(uint256 amount) (ankrPOL). The request is sent via Ankr Staking and MetaMask or another wallet connected to Ethereum.

Upon receiving the stake, the PolygonPool smart contract calculates the equivalent amount of ankrPOL and mints it to the user’s address found in the stake transaction.

PolygonPool emits a StakePending(msg.sender, amount) event.

On the Ankr Staking Dashbaord, the user can import the received ankrPOL tokens to MetaMask or another wallet connected to Ethereum.

Ankr backend collects the POL staked by users, transferring them from the smart contract to the address controlled by the platform, and makes a validator stake on the Ankr POL Validator node if the conditions below are met.

Ankr Staking Dashboard can call ankrPOL::balanceOf(address account) to check the user’s current ankrPOL balance.

The Ankr backend monitors blockchain events coming from the PolygonPool smart contract. Upon a new staking event, the backend:

  1. Checks if the newly available POL number (N) is >= to the minimum threshold. If yes, the available POL are sent from the PolygonPool smart contract to the address managed by Ankr. Else, the backend waits for the next stake event from PolygonPool. N is a config parameter.

  2. At the point when POL tokens become available at the Ankr address, a staking transaction is issued.

  3. The Ankr backend monitors staking status and rewards, and restakes the rewards when the sum of the staked POL reward is > threshold. The threshold is a config parameter.

On Polygon

User sends a transaction to PolSwapPool to swaps their POL for ankrPOL.

Ankr, being the main liquidity provider, rebalances the pool to have enough POL and ankrPOL in it for the users.

Rebalancing PolSwapPool

The pool must be kept in balance, so:

  • Whenever there's more POL in it than ankrPOL, Ankr bridges POL to the Ethereum network, stakes it, gets ankrPOL and bridges it back to Polygon to add to the pool.
  • Whenever there's more ankrPOL in it than POL, Ankr bridges ankrPOL to the Ethereum network, unstakes it, gets POL and bridges it back to Polygon to add to the pool.

Daily exchange ratio updates

The ratio updates can be obtained by calling the ankrPOL::ratio() (opens in a new tab) read function.

Unstaking workflow

On Ethereum

The workflow is both user and Ankr-driven. The user part is Step 1, the Ankr part is Steps 2–11.

  1. User navigates to the dedicated page on Ankr Staking and unstakes their POL.
  2. Ankr Staking Dashboard checks the user’s ankrPOL balance and displays a form to enter the number of POL to unstake.
  3. Ankr Staking Dashboard calls PolygonPool::unstakeCerts(uint256 amount, uint256 fee, uint256 useBeforeBlock, bytes memory signature).
  4. PolygonPool transfers the equal amount of ankrPOL from the user to itself (technically, it locks the amount of ankrPOL to unstake in the user’s account).
  5. PolygonPool issues an unstake event PolClaimPending(msg.sender, amount).
  6. Ankr Staking Dashboard displays a notification to the user to indicate the unstaking request has been registered.
  7. Ankr backend detects the unstake event and sends an unstake request to the POL smart contract on the Ethereum blockchain.
  8. When unstake is completed and POL received at the platform address, the backend sends the POL to the Polygon Pool smart contract: PolygonPool::serveClaims().
  9. PolygonPool sends the POL to the user address, burns the ankrPOL tokens, and issues an event saying the unstake request has been completed.

On Polygon

User sends a transaction to PolSwapPool to swaps their ankrPOL for POL. If the current pool capacity matches the unstake request, the user swaps their ankrPOL via the Ankr's swap pool on Polygon for POL. No unbonding period applied for sending POL to the user's wallet, since it's an instant swap procedure.

Ankr, being the main liquidity provider, rebalances the pool to have enough POL and ankrPOL in it for the users.