Skip to content

Commit

Permalink
[LIVE-13624] Feature - MATIC to POL migration (#7710)
Browse files Browse the repository at this point in the history
* Update MATIC to POL in currencies and add icon

* Update tests regarding the MATIC -> POL migration

* changeset
  • Loading branch information
lambertkevin authored Sep 5, 2024
1 parent e6b8cea commit cc291f5
Show file tree
Hide file tree
Showing 15 changed files with 69 additions and 54 deletions.
12 changes: 12 additions & 0 deletions .changeset/empty-experts-sing.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
---
"@ledgerhq/cryptoassets": patch
"@ledgerhq/crypto-icons-ui": patch
"@ledgerhq/coin-evm": patch
"ledger-live-desktop": patch
"live-mobile": patch
"@ledgerhq/live-common": patch
"@ledgerhq/live-countervalues": patch
"@ledgerhq/coin-framework": patch
---

Migrating the Matic currency to POL (see https://polygon.technology/blog/save-the-date-matic-pol-migration-coming-september-4th-everything-you-need-to-know)
12 changes: 6 additions & 6 deletions apps/ledger-live-desktop/tests/enum/Account.ts
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,8 @@ export class Account {
"Tezos 2",
"tz1g3uEPZ9T3AhUZDTbGW9V43JRfizJmSnPv",
);
static readonly MATIC_1 = new Account(
Currency.MATIC,
static readonly POL_1 = new Account(
Currency.POL,
"Polygon 1",
"0xB9051f83AC6e147924377BBEebd1Aa7aB43a67F6",
);
Expand Down Expand Up @@ -277,14 +277,14 @@ export class Account {
"0xB9051f83AC6e147924377BBEebd1Aa7aB43a67F6",
);

static readonly MATIC_DAI_1 = new Account(
Currency.MATIC_DAI,
static readonly POL_DAI_1 = new Account(
Currency.POL_DAI,
"Polygon 1",
"0xB9051f83AC6e147924377BBEebd1Aa7aB43a67F6",
);

static readonly MATIC_UNI = new Account(
Currency.MATIC_UNI,
static readonly POL_UNI = new Account(
Currency.POL_UNI,
"Polygon 1",
"0xB9051f83AC6e147924377BBEebd1Aa7aB43a67F6",
);
Expand Down
6 changes: 3 additions & 3 deletions apps/ledger-live-desktop/tests/enum/Currency.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export class Currency {
static readonly ALGO = new Currency("Algorand", "ALGO", AppInfos.ALGORAND);
static readonly ATOM = new Currency("Cosmos", "ATOM", AppInfos.COSMOS);
static readonly XTZ = new Currency("Tezos", "XTZ", AppInfos.TEZOS);
static readonly MATIC = new Currency("Polygon", "MATIC", AppInfos.POLYGON);
static readonly POL = new Currency("Polygon", "POL", AppInfos.POLYGON);
static readonly BSC = new Currency("Binance Smart Chain", "BNB", AppInfos.BINANCE_SMART_CHAIN);
static readonly TON = new Currency("Ton", "TON", AppInfos.TON);
static readonly ETH_USDT = new Currency("Tether USD", "USDT", AppInfos.ETHEREUM);
Expand All @@ -40,6 +40,6 @@ export class Currency {
AppInfos.BINANCE_SMART_CHAIN,
);
static readonly BSC_SHIBA = new Currency("Shiba Inu", "SHIB", AppInfos.BINANCE_SMART_CHAIN);
static readonly MATIC_DAI = new Currency("(PoS) Dai Stablecoin", "DAI", AppInfos.POLYGON);
static readonly MATIC_UNI = new Currency("Uniswap (PoS)", "UNI", AppInfos.POLYGON);
static readonly POL_DAI = new Currency("(PoS) Dai Stablecoin", "DAI", AppInfos.POLYGON);
static readonly POL_UNI = new Currency("Uniswap (PoS)", "UNI", AppInfos.POLYGON);
}
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
{
"type": "CryptoCurrency",
"id": "polygon",
"ticker": "MATIC",
"ticker": "POL",
"name": "Polygon",
"family": "ethereum",
"color": "#6d29de",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -164,7 +164,7 @@
{
"type": "CryptoCurrency",
"id": "polygon",
"ticker": "MATIC",
"ticker": "POL",
"name": "Polygon",
"family": "ethereum",
"color": "#6d29de",
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ const subAccounts: Account[] = [
Account.ALGO_USDT_1,
Account.TRX_USDT,
Account.BSC_BUSD_1,
Account.MATIC_DAI_1,
Account.POL_DAI_1,
];

const subAccountReceive: Account[] = [
Expand All @@ -19,8 +19,8 @@ const subAccountReceive: Account[] = [
Account.TRX_BTT,
Account.BSC_BUSD_1,
Account.BSC_SHIBA,
Account.MATIC_DAI_1,
Account.MATIC_UNI,
Account.POL_DAI_1,
Account.POL_UNI,
];

for (const token of subAccounts) {
Expand Down
2 changes: 1 addition & 1 deletion apps/ledger-live-mobile/android/dapp-store/config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ release:
Bitcoin (BTC), Ethereum (ETH), Binance Coin (BNB), Ripple (XRP), Bitcoin
Cash (BCH), Litecoin (LTC), Tezos (XTZ), Stellar (XLM), Polkadot (DOT),
Tron (TRX), Polygon (MATIC), Ethereum Classic (ETC), Dash (DASH), Cosmos
Tron (TRX), Polygon (POL), Ethereum Classic (ETC), Dash (DASH), Cosmos
(ATOM), Elrond (EGLD), Zcash (ZEC), Dogecoin (DOGE), Digibyte (DGB),
Bitcoin Gold (BTG), Decred (DCR), Qtum (QTUM), Algorand (ALGO), Komodo
(KMD), Horizen (ZEN), Stakenet (XSN), ERC-20 and BEP-20 tokens.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ describe("Receive Flow", () => {
it("Should access to receive after importing a cryptocurrency on a selected network", async () => {
await openReceive();
await app.common.performSearch("Polygon");
await app.receive.selectAsset("MATIC");
await app.receive.selectAsset("POL");
await app.receive.selectNetwork("binance smart chain");
first && (await deviceAction.selectMockDevice(), (first = false));
await deviceAction.openApp();
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -228,7 +228,7 @@ exports[`formatCurrencyUnit with custom options with locale de-DE should correct

exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Polkadot unit (DOT) 1`] = `"1.234.567,8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Polygon unit (MATIC) 1`] = `"0,012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Polygon unit (POL) 1`] = `"0,012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale de-DE should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0,012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -552,7 +552,7 @@ exports[`formatCurrencyUnit with custom options with locale en-US should correct

exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Polkadot unit (DOT) 1`] = `"1,234,567.8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Polygon unit (MATIC) 1`] = `"0.012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Polygon unit (POL) 1`] = `"0.012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale en-US should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0.012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -876,7 +876,7 @@ exports[`formatCurrencyUnit with custom options with locale es-ES should correct

exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Polkadot unit (DOT) 1`] = `"1.234.567,8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Polygon unit (MATIC) 1`] = `"0,012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Polygon unit (POL) 1`] = `"0,012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale es-ES should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0,012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -1200,7 +1200,7 @@ exports[`formatCurrencyUnit with custom options with locale fr-FR should correct

exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Polkadot unit (DOT) 1`] = `"1 234 567,8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Polygon unit (MATIC) 1`] = `"0,012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Polygon unit (POL) 1`] = `"0,012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale fr-FR should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0,012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -1524,7 +1524,7 @@ exports[`formatCurrencyUnit with custom options with locale ja-JP should correct

exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Polkadot unit (DOT) 1`] = `"1,234,567.8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Polygon unit (MATIC) 1`] = `"0.012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Polygon unit (POL) 1`] = `"0.012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale ja-JP should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0.012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -1848,7 +1848,7 @@ exports[`formatCurrencyUnit with custom options with locale ko-KR should correct

exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Polkadot unit (DOT) 1`] = `"1,234,567.8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Polygon unit (MATIC) 1`] = `"0.012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Polygon unit (POL) 1`] = `"0.012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale ko-KR should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0.012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -2172,7 +2172,7 @@ exports[`formatCurrencyUnit with custom options with locale pt-BR should correct

exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Polkadot unit (DOT) 1`] = `"1.234.567,8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Polygon unit (MATIC) 1`] = `"0,012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Polygon unit (POL) 1`] = `"0,012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale pt-BR should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0,012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -2496,7 +2496,7 @@ exports[`formatCurrencyUnit with custom options with locale ru-RU should correct

exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Polkadot unit (DOT) 1`] = `"1 234 567,8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Polygon unit (MATIC) 1`] = `"0,012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Polygon unit (POL) 1`] = `"0,012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale ru-RU should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0,012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -2820,7 +2820,7 @@ exports[`formatCurrencyUnit with custom options with locale tr-TR should correct

exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Polkadot unit (DOT) 1`] = `"1.234.567,8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Polygon unit (MATIC) 1`] = `"0,012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Polygon unit (POL) 1`] = `"0,012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale tr-TR should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0,012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -3144,7 +3144,7 @@ exports[`formatCurrencyUnit with custom options with locale zh-CN should correct

exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Polkadot unit (DOT) 1`] = `"1,234,567.8900000000- -DOT"`;

exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Polygon unit (MATIC) 1`] = `"0.012345678900000000- -MATIC"`;
exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Polygon unit (POL) 1`] = `"0.012345678900000000- -POL"`;

exports[`formatCurrencyUnit with custom options with locale zh-CN should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0.012345678900000000- -𝚝ETH"`;

Expand Down Expand Up @@ -3468,7 +3468,7 @@ exports[`formatCurrencyUnit with default options should correctly format Pirl un

exports[`formatCurrencyUnit with default options should correctly format Polkadot unit (DOT) 1`] = `"1,234,567"`;

exports[`formatCurrencyUnit with default options should correctly format Polygon unit (MATIC) 1`] = `"0.0123456"`;
exports[`formatCurrencyUnit with default options should correctly format Polygon unit (POL) 1`] = `"0.0123456"`;

exports[`formatCurrencyUnit with default options should correctly format Polygon zkEVM Testnet unit (ETH) 1`] = `"0.0123456"`;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,16 +1,17 @@
import Eth from "@ledgerhq/hw-app-eth";
import { BigNumber } from "bignumber.js";
import { ethers, providers } from "ethers";
import { Account } from "@ledgerhq/types-live";
import { getCryptoCurrencyById } from "@ledgerhq/cryptoassets/currencies";
import { Scenario, ScenarioTransaction } from "@ledgerhq/coin-tester/main";
import { encodeTokenAccountId } from "@ledgerhq/coin-framework/account/index";
import { killSpeculos, spawnSpeculos } from "@ledgerhq/coin-tester/signers/speculos";
import { Account } from "@ledgerhq/types-live";
import { resetIndexer, initMswHandlers, setBlock, indexBlocks } from "../indexer";
import { buildAccountBridge, buildCurrencyBridge } from "../../../bridge/js";
import { Transaction as EvmTransaction } from "../../../types";
import { getCoinConfig, setCoinConfig } from "../../../config";
import { makeAccount } from "../../fixtures/common.fixtures";
import { defaultNanoApp } from "../scenarios.test";
import { killAnvil, spawnAnvil } from "../anvil";
import resolver from "../../../hw-getAddress";
import {
Expand All @@ -21,13 +22,12 @@ import {
impersonnateAccount,
polygon,
} from "../helpers";
import { defaultNanoApp } from "../scenarios.test";

type PolygonScenarioTransaction = ScenarioTransaction<EvmTransaction, Account>;

const makeScenarioTransactions = ({ address }: { address: string }) => {
const send1MaticTransaction: PolygonScenarioTransaction = {
name: "Send 1 Matic",
name: "Send 1 POL",
amount: new BigNumber(ethers.utils.parseEther("1").toString()),
recipient: ethers.constants.AddressZero,
expect: (previousAccount, currentAccount) => {
Expand Down
Loading

0 comments on commit cc291f5

Please sign in to comment.