These docs are for v2.0. Click to read the latest docs for v3.0.
improved

Polygon Mainnet Upgrade

Polygon’s mainnet upgrade is set for September 4, 2024, marking the transition of its native token from MATIC to POL. Following the upgrade, POL will become the primary token used for gas fees, replacing MATIC.

MATIC holders on Polygon PoS will not need to take any action, whereas MATIC holders on other blockchains like Ethereum will need to migrate. This guide describes the migration process of MATIC to POL, specifically on Ethereum.

📘

Read more about the Polygon Mainnet Upgrade.

Migration required?

Polygon Migration MATIC to POL

Polygon Migration MATIC to POL

MATIC Holders on Polygon PoS Mainnet

On September 4, 2024, all MATIC tokens on the Polygon PoS chain will automatically migrate to POL tokens. No user input is required.

MATIC Holders on Ethereum Mainnet

Wallet-API users that hold MATIC tokens on the Ethereum chain can upgrade (MATIC to POL) permissionlessly using the deployed migration contract.

📘

How to Migrate on Ethereum - Wallet-API Users

Below is a detailed description of the migration process from MATIC to POL for Wallet-API users.

1. Retrieve the ERC20 token balance

Wallet-API users must first query the ERC20 token balance in their Ethereum wallets to retrieve the MATIC tokens. In the response, you will get the tokenAddress and the rawBalance which are required for the migration process.

Following is an example of querying the ERC20 balance using the wallet UUID.

Request Endpoint: reference

GET /api/wallets/{walletId}/balance/tokens

Response Body

📘

Copy the tokenAddress and the rawBalance as they will be used later in the guide.

{
    "success": true,
    "result": [
        {
            "tokenAddress": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0",
            "rawBalance": "50987335440767736754",
            "balance": 50.987335,
            "decimals": 18,
            "symbol": "MATIC",
            "logo": "https://logo.moralis.io/0x1_0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0_89c931b3fcf74fe39db7a195bf8a3aa5",
            "type": "ERC20",
            "transferable": true,
            "name": "Matic Token",
            "possibleSpam": false,
            "exchange": {
                "usdPrice": 0.4975086444831248,
                "usdBalanceValue": 25.366640140942746
            }
        }
    ]
}

2. Call approve function on MATIC token contract

The next step is creating an approval of the MATIC tokens for the migration contract. You need to call the MATIC token contract and supply it with the spender address (migration contract address), and the value (raw value of MATIC tokens to approve).

This will set the approval for the migration contract (0x19c5042aB91C9e4C0C92Cbb6DEEb959a3e13306f).

📘

  • For this example we set the approval value as 2000000000000000000 which equals to 2 MATIC tokens.
  • If you wish to migrate all MATIC tokens, enter the value as the rawBalance from response of Step 1.

Request Endpoint: reference

POST /api/transactions/execute
{
    "transactionRequest": {
        "type": "CONTRACT_EXECUTION", // keep as is
        "functionName": "approve", // keep as is
        "value": 0.0, // keep as is
        "inputs": [
            {
                "type": "address", // keep as is
                "value": "0x19c5042aB91C9e4C0C92Cbb6DEEb959a3e13306f" // keep as it (migration contract address)
            },
            {
                "type": "uint256", // keep as is
                "value": "2000000000000000000" // enter the raw balance of MATIC tokens to approve (rawBalance from response of Step 1)
            }
        ],
        "walletId": "5a65042e-26ad-44f3-bbd0-379bddd84df1", // enter the wallet UUID holding MATIC
        "to": "0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0", // enter the ERC20 MATIC token contract address (tokenAddress from response of Step 1)
        "secretType": "ETHEREUM" // blockchain of the tx
    }
}

Response Body

🚧

Make sure the transaction is successful on the blockchain before proceeding to the next step.

{
    "success": true,
    "result": {
        "id": "d4e8ddbd-6946-4a2b-bedd-0e130529ee7a",
        "transactionHash": "0xe55f80ee56a85f15c206b6c308e12a1304375e37625e9b59b176773f92329259"
    }
}

3. Call migrate function on the migration contract

Next, you can call the migrate function on the migration contract by supplying it with the same raw value of MATIC tokens, as you did in the previous approve contract call.

Request Endpoint: reference

POST /api/transactions/execute
{
    "transactionRequest": {
        "type": "CONTRACT_EXECUTION", // keep as is
        "functionName": "migrate", // keep as is
        "value": 0.0, // keep as is
        "inputs": [
            {
                "type": "uint256", // keep as is
                "value": "2000000000000000000" // enter the raw balance of MATIC tokens
            }
        ],
        "walletId": "a7185cb1-66ec-41c7-94e3-be7a7e17ee67", // enter the wallet UUID holding MATIC
        "to": "0x29e7DF7b6A1B2b07b731457f499E1696c60E2C4e", // keep as is (migration contract address)
        "secretType": "ETHEREUM" // blockchain of the tx
    }
}

Response Body

{
    "success": true,
    "result": {
        "id": "d4e8ddbd-6946-4a2b-bedd-0e130529ee7a",
        "transactionHash": "0xad8a8d9fdb7f14c3215a3133677edd2485164beef74dcf2680b6fcfdbf188f3f"
    }
}

Successful Migration to POL