maticnetwork / contracts

Smart contracts comprising the business logic of the Matic Network
https://matic.network
GNU General Public License v3.0
1.15k stars 506 forks source link

Plasma bridge update #483

Closed simonDos closed 11 months ago

simonDos commented 1 year ago

Plasma Bridge Modifications

The plasma bridge will be modified to bridge POL for users trying to bridge MATIC after the upgrade.

The following changes will be made:

Changes Implementation
1. The entire MATIC balance held by the bridge will be converted to POL. This also has the added benefit that there is a sufficient amount of MATIC for unmigration for the StakeManager rewards. A publicly callable function to trigger the conversion has been written for this.
2. When depositing MATIC, automatically convert it to POL on L1 and bridge MATIC

A convenience functionality has been added in _createDepositBlock, which automatically converts MATIC to POL when a user tries to bridge MATIC.

3. When depositing POL, bridge MATIC as well Is caught in the _createDepositBlock as well, changing the token address to MATIC before syncState
4. When bridging MATIC back to L1 (withdrawing), always pay out POL Additional functionality in transferAssets to pay out POL instead of MATIC

Internally, the MATIC address will still be used for all POL bridging operations, as the behaviour of the native token on the PoS side will not be modified and thus can keep operating as usual.

Addresses for the root MATIC contract, the new POL address, as well as the PolygonMigration contract will be added to the registry using updateContractMap using “matic”, “pol” and “polygonMigration” as keys.