PIP-42: Polygon 2.0 - Upgrade PoS Staking to Use POL

PIP-42: Polygon 2.0 - Upgrade PoS Staking to Use POL

Authors: Simon Dosch, @ZeroEkkusu, @oneski22, @pgpg, @pgo

Type: Contracts

Table of Contents:

  • Abstract
  • Motivation
  • Definitions
  • Specification
    • Frontier Roadmap
  • Security Considerations
  • Backward Compatibility

Abstract

This proposal calls for upgrading the staking contract for the Polygon PoS network to change from using MATIC 0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0 as the primary staking token to POL in a method that ensures maximum backward compatibility. The authors recommend this by upgrading the PoS Stake Manager Contract 0x5e3Ef299fDDf15eAa0432E6e66473ace8c13D908 to a new implementation at 0x97a3500083348A147F419b8a65717909762c389f that:

  • Converts all the MATIC in the Stake Manager to POL
  • Uses POL for all new staking and unstaking requests
  • Will still allow for using existing functions when staking and unstaking MATIC by leveraging the POL Migration Contract 0x29e7DF7b6A1B2b07b731457f499E1696c60E2C4e to preserve maximum backward compatibility.
  • Adds new POL functions wherever necessary. These can be used to stake using the new POL token

This proposed upgrade will not change any contracts on the Polygon PoS Network. Likewise, all other properties about staking (reward rate, unbonding period, slashing etc.) will remain unchanged.

Motivation

The staking token is the token which stakers and validators of the Polygon PoS network use to secure the network, and come to consensus on the state. The present staking token is MATIC which was set as the staking token upon genesis of the Polygon PoS network. Now that POL 0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6 is live, the authors propose setting it as the staking token of the network via an upgrade of the Stake Manager in a maximally backward compatible manner.

Specification

Upgrade the StakeManagerProxy contract to a new implementation at 0x97a3500083348A147F419b8a65717909762c389f.
Upgrade the ValidatorShareProxy beacon proxies by updating the ValidatorShare entry in the Registy to 0x053fa9b934b83e1e0ffc7e98a41aadc3640bb462.

As an example for the new POL functions, buyVoucher still exists and we can now also use buyVoucherPOL which both call the same function internally, the only difference being that the first one will trigger a migrate call to exchange MATIC for POL before moving on:

function buyVoucher(uint256 _amount, uint256 _minSharesToMint) public returns (uint256 amountToDeposit) {
    return _buyVoucher(_amount, _minSharesToMint, false);
}

function buyVoucherPOL(uint256 _amount, uint256 _minSharesToMint) public returns (uint256 amountToDeposit) {
    return _buyVoucher(_amount, _minSharesToMint, true);
}

Backward Compatibility

Backward compatibility has been preserved by internally converting MATIC to POL (and vice-versa) in the existing functions.

Security Considerations

This upgrade adjusts a core contract of the Polygon PoS network. All proper security procedures including necessary audits will be taken, and should be carefully reviewed prior to activation.

References

Copyright

All copyrights and related rights in this work are waived under CC0 1.0 Universal.

6 Likes

Looks like a placeholder value is needed there unless the new stake manager is deployed via create2 so the address can be known given the existing bytecode.

TBD for now?

3 Likes

do the delegates need to do something, or will the transition happen automatically?

2 Likes

To help with testing / understanding the upgrade, an release candidate of the new implementations has been deployed on Sepolia.

Sepolia (Testnet)

Release Candidate:

StakeManager:

https://sepolia.etherscan.io/address/0x924562F8aE8BE16F777ae8076beC0215f62B8c23

ValidatorShare:

https://sepolia.etherscan.io/address/0x09a7d072ffd1bbf128d7d9da90decc0e1cbb9e91

1 Like

Instead of appending the Legacy suffix to the old methods, would you consider adding a POL suffix to the new methods? This will prevent any existing integrations from breaking.

2 Likes

Hi @oneski22

  1. is there any timeline for the upgrade?
  2. How does the migration process work? Do you just stop the reward in the existing staking contract to disincentivize staking in the old contract and force users to migrate to the new one?
  3. What is the next step for DeFi integration for POL? Currently, it is not as integrated with lending markets and liquidity pools
  4. Any plans on incentivising DeFi usage for POL in liquidity and lending marketplace?
  5. What should a staker be aware of for the new staking contract in terms of source of reward and APR

Thank you in advance

2 Likes

Thank you sir for all informations a good working

Everything you need to know about the migration is in this blog post:
https://polygon.technology/blog/save-the-date-matic-pol-migration-coming-september-4th-everything-you-need-to-know

1 Like

Has the new contract been deployed? If so, could you update the address before the upgrade takes place, please?

2 Likes

Backward Compatibility

Systems that expect to stake and unstake MATIC from the PoS Staking system will be affected unless they move to using the new legacy functions.

Looks like with the recent changes this needs to be updated.

No legacy functions anymore, POL functions are added instead, so staking / unstaking MATIC can be done as normal. (aside from updating Staking manager address).

2 Likes

thanks for flagging will update this shortly!

1 Like

thanks for flagging, all addresses will be added in shortly!

2 Likes

Should now be up to date since Zero’s changes