Skip to content

Commit

Permalink
chore: matic-pol migration (#1694)
Browse files Browse the repository at this point in the history
Co-authored-by: Christopher Howard <[email protected]>
Co-authored-by: Bruno Barbieri <[email protected]>
  • Loading branch information
3 people authored Sep 13, 2024
1 parent dc11fa4 commit 00d7b45
Show file tree
Hide file tree
Showing 21 changed files with 48 additions and 62 deletions.
4 changes: 2 additions & 2 deletions e2e/serial/swap/1_swapFlow1.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -644,12 +644,12 @@ it('should be able to filter assets to buy by network', async () => {
});
await delayTime('long');
await findElementByTestIdAndClick({
id: `${SWAP_VARIABLES.MATIC_POLYGON_ID}-favorites-token-to-buy-row`,
id: `${SWAP_VARIABLES.POL_POLYGON_ID}-favorites-token-to-buy-row`,
driver,
});
// ARBITRUM
await findElementByTestIdAndClick({
id: `${SWAP_VARIABLES.MATIC_POLYGON_ID}-token-to-buy-token-input-remove`,
id: `${SWAP_VARIABLES.POL_POLYGON_ID}-token-to-buy-token-input-remove`,
driver,
});
await findElementByTestIdAndClick({
Expand Down
2 changes: 1 addition & 1 deletion e2e/walletVariables.ts
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@ export const SWAP_VARIABLES = {
ETH_MAINNET_ID: 'eth_1',
ETH_OPTIMISM_ID: '0x0000000000000000000000000000000000000000_10',
GMX_ARBITRUM_ID: '0xfc5a1a6eb076a2c7ad06ed22c90d7e710e35ad0a_42161',
MATIC_POLYGON_ID: '0x0000000000000000000000000000000000001010_137',
POL_POLYGON_ID: '0x0000000000000000000000000000000000001010_137',
OP_OPTIMISM_ID: '0x4200000000000000000000000000000000000042_10',
UNI_BNB_ID: '0xbf5140a22578168fd562dccf235e5d43a02ce9b1_56',
USDC_ARBITRUM_ID: '0xaf88d065e77c8cc2239327c5edb3a432268e5831_42161',
Expand Down
50 changes: 18 additions & 32 deletions lavamoat/build-webpack/policy.json
Original file line number Diff line number Diff line change
Expand Up @@ -614,10 +614,10 @@
"eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-module-imports": true,
"eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-simple-access": true,
"eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-split-export-declaration": true,
"eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-validator-identifier": true,
"eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/template": true,
"jest>@jest/core>jest-snapshot>@babel/traverse": true,
"jest>@jest/core>jest-snapshot>@babel/types": true,
"jest>@jest/core>jest-snapshot>@babel/types>@babel/helper-validator-identifier": true
"jest>@jest/core>jest-snapshot>@babel/types": true
}
},
"eslint-config-rainbow>eslint-import-resolver-babel-module>@babel/core>@babel/helper-module-transforms>@babel/helper-module-imports": {
Expand Down Expand Up @@ -1141,9 +1141,16 @@
"console.warn": true,
"process.emitWarning": true
},
"packages": {
"jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>@babel/highlight": true,
"jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>chalk": true
}
},
"jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>@babel/highlight": {
"packages": {
"jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>chalk": true,
"lavamoat>@babel/highlight": true
"jest>@jest/core>jest-snapshot>@babel/traverse>@babel/types>@babel/helper-validator-identifier": true,
"react>loose-envify>js-tokens": true
}
},
"jest>@jest/core>jest-snapshot>@babel/traverse>@babel/code-frame>chalk": {
Expand Down Expand Up @@ -1222,34 +1229,6 @@
"lavamoat>lavamoat-core>@babel/types>to-fast-properties": true
}
},
"lavamoat>@babel/highlight": {
"packages": {
"lavamoat>@babel/highlight>@babel/helper-validator-identifier": true,
"lavamoat>@babel/highlight>chalk": true,
"react>loose-envify>js-tokens": true
}
},
"lavamoat>@babel/highlight>chalk": {
"globals": {
"process.env.TERM": true,
"process.platform": true
},
"packages": {
"lavamoat>@babel/highlight>chalk>ansi-styles": true,
"lavamoat>@babel/highlight>chalk>escape-string-regexp": true,
"supports-color": true
}
},
"lavamoat>@babel/highlight>chalk>ansi-styles": {
"packages": {
"lavamoat>@babel/highlight>chalk>ansi-styles>color-convert": true
}
},
"lavamoat>@babel/highlight>chalk>ansi-styles>color-convert": {
"packages": {
"lavamoat>@babel/highlight>chalk>ansi-styles>color-convert>color-name": true
}
},
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name": {
"packages": {
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template": true,
Expand All @@ -1269,10 +1248,17 @@
"process.emitWarning": true
},
"packages": {
"lavamoat>@babel/highlight": true,
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>@babel/highlight": true,
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>chalk": true
}
},
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>@babel/highlight": {
"packages": {
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>chalk": true,
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/types>@babel/helper-validator-identifier": true,
"react>loose-envify>js-tokens": true
}
},
"lavamoat>lavamoat-tofu>@babel/traverse>@babel/helper-function-name>@babel/template>@babel/code-frame>chalk": {
"globals": {
"process.env.TERM": true,
Expand Down
6 changes: 3 additions & 3 deletions src/core/references/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -50,8 +50,8 @@ export const ETH_ADDRESS = 'eth';
export const DAI_ADDRESS = '0x6b175474e89094c44da98b954eedeac495271d0f';
export const USDC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';
export const WBTC_ADDRESS = '0x2260fac5e5542a773aa44fbcfedf7c193bc2c599';
export const MATIC_MAINNET_ADDRESS =
'0x7d1afa7b718fb893db30a3abc0cfc608aacfebb0';
export const POL_MAINNET_ADDRESS =
'0x455e53CBB86018Ac2B8092FdCd39d8444aFFC3F6';
export const BNB_MAINNET_ADDRESS = '0xb8c77482e45f1f44de1745f52c74426c631bdd52';
export const SOCKS_ADDRESS = '0x23b608675a2b2fb1890d3abbd85c5775c51691d5';
export const WETH_ADDRESS = '0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
Expand Down Expand Up @@ -84,7 +84,7 @@ export const DAI_BSC_ADDRESS = '0x6b175474e89094c44da98b954eedeac495271d0f';
export const USDC_BSC_ADDRESS = '0xa0b86991c6218b36c1d19d4a2e9eb0ce3606eb48';

// polygon
export const MATIC_POLYGON_ADDRESS =
export const POL_POLYGON_ADDRESS =
'0x0000000000000000000000000000000000001010';
export const WETH_POLYGON_ADDRESS =
'0x7ceb23fd6bc0add59e62ac25578270cff1b9f619';
Expand Down
2 changes: 1 addition & 1 deletion src/core/resources/addys/addysSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ export interface AddySummary {
[key: Address]: {
summary: {
native_balance_by_symbol: {
[key in 'ETH' | 'MATIC' | 'BNB' | 'AVAX']: {
[key in 'ETH' | 'POL' | 'BNB' | 'AVAX']: {
symbol: string;
quantity: string;
decimals: number;
Expand Down
4 changes: 2 additions & 2 deletions src/core/resources/search/tokenSearch.ts
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ import {
import {
BNB_BSC_ADDRESS,
ETH_ADDRESS,
MATIC_POLYGON_ADDRESS,
POL_POLYGON_ADDRESS,
} from '~/core/references';
import { ChainId } from '~/core/types/chains';
import {
Expand Down Expand Up @@ -111,7 +111,7 @@ function parseTokenSearch(assets: SearchAsset[], chainId: ChainId) {
`${ETH_ADDRESS}_${ChainId.optimism}`,
`${ETH_ADDRESS}_${ChainId.arbitrum}`,
`${BNB_BSC_ADDRESS}_${ChainId.bsc}`,
`${MATIC_POLYGON_ADDRESS}_${ChainId.polygon}`,
`${POL_POLYGON_ADDRESS}_${ChainId.polygon}`,
`${ETH_ADDRESS}_${ChainId.base}`,
`${ETH_ADDRESS}_${ChainId.zora}`,
`${ETH_ADDRESS}_${ChainId.avalanche}`,
Expand Down
4 changes: 2 additions & 2 deletions src/core/state/favorites/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ import {
ETH_BLAST_ADDRESS,
ETH_OPTIMISM_ADDRESS,
ETH_ZORA_ADDRESS,
MATIC_POLYGON_ADDRESS,
POL_POLYGON_ADDRESS,
OP_ADDRESS,
SOCKS_ADDRESS,
SOCKS_ARBITRUM_ADDRESS,
Expand Down Expand Up @@ -77,7 +77,7 @@ const defaultFavorites = {
],
[ChainId.bsc]: [BNB_BSC_ADDRESS, DAI_BSC_ADDRESS, USDC_BSC_ADDRESS],
[ChainId.polygon]: [
MATIC_POLYGON_ADDRESS,
POL_POLYGON_ADDRESS,
WETH_POLYGON_ADDRESS,
DAI_POLYGON_ADDRESS,
USDC_POLYGON_ADDRESS,
Expand Down
2 changes: 1 addition & 1 deletion src/core/types/transactions.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,7 +36,7 @@ type BaseTransaction = {
direction?: TransactionDirection;
flashbots?: boolean;

value?: string; // network asset amount sent with the tx (like eth or matic)
value?: string; // network asset amount sent with the tx (like eth or pol)
fee?: string;
native?: {
// fee and value but in the user prefered currency terms (USD, EUR, etc)
Expand Down
12 changes: 6 additions & 6 deletions src/entries/popup/hooks/useWalletsSummary.ts
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ const parseAddressSummary = ({
const {
ETH: ethRawBalance,
BNB: bnbRawBalance,
MATIC: maticRawBalance,
POL: polRawBalance,
AVAX: avaxRawBalance,
} = addressData?.summary.native_balance_by_symbol || {};

Expand All @@ -69,14 +69,14 @@ const parseAddressSummary = ({
currentCurrency,
).amount;

const maticBalance = convertRawAmountToBalance(
maticRawBalance?.quantity || 0,
const polBalance = convertRawAmountToBalance(
polRawBalance?.quantity || 0,
{
decimals: 18,
},
).amount;
const maticCurrencyBalance = convertAmountAndPriceToNativeDisplay(
maticBalance || 0,
const polCurrencyBalance = convertAmountAndPriceToNativeDisplay(
polBalance || 0,
nativeAssets?.[ChainId.polygon]?.price?.value || 0,
currentCurrency,
).amount;
Expand All @@ -92,7 +92,7 @@ const parseAddressSummary = ({

const balance = add(
add(ethCurrencyBalance, bnbCurrencyBalance),
add(maticCurrencyBalance, avaxCurrencyBalance),
add(polCurrencyBalance, avaxCurrencyBalance),
);

const balanceDisplay = convertAmountToNativeDisplay(balance, currentCurrency);
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/ar_AR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "كلما استخدمت Rainbow أكثر، كلما حصلت على مكافآت أكبر",
"balance_required": "مطلوب رصيد في المحفظة",
"ensure_you_have_a_balance_on": "للمتابعة، تأكد من امتلاكك لرصيد ETH على إحدى الشبكات التالية:",
"or_alternatively_balance_on": "أو بديلًا، رصيد MATIC على شبكة Polygon أو رصيد BNB على شبكة BSC",
"or_alternatively_balance_on": "أو بديلًا، رصيد POL على شبكة Polygon أو رصيد BNB على شبكة BSC",
"fund_my_wallet": "تمويل محفظتي"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/en_US.json
Original file line number Diff line number Diff line change
Expand Up @@ -1461,7 +1461,7 @@
"the_more_you_use": "The more you use Rainbow, the more you’ll be rewarded",
"balance_required": "Wallet balance required",
"ensure_you_have_a_balance_on": "To continue, ensure you have an ETH balance on one of the following networks:",
"or_alternatively_balance_on": "Or alternatively, a MATIC balance on Polygon or a BNB balance on BSC",
"or_alternatively_balance_on": "Or alternatively, a POL balance on Polygon or a BNB balance on BSC",
"fund_my_wallet": "Fund My Wallet"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/es_419.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Cuanto más uses Rainbow, más serás recompensado",
"balance_required": "Saldo de billetera requerido",
"ensure_you_have_a_balance_on": "Para continuar, asegúrate de tener saldo en ETH en una de las siguientes redes:",
"or_alternatively_balance_on": "O alternativamente, saldo en MATIC en Polygon o saldo en BNB en BSC",
"or_alternatively_balance_on": "O alternativamente, saldo en POL en Polygon o saldo en BNB en BSC",
"fund_my_wallet": "Financiar Mi Billetera"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/fr_FR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Plus vous utilisez Rainbow, plus vous serez récompensé",
"balance_required": "Solde du portefeuille requis",
"ensure_you_have_a_balance_on": "Pour continuer, assurez-vous d'avoir un solde en ETH sur l'un des réseaux suivants :",
"or_alternatively_balance_on": "Ou alternativement, un solde en MATIC sur Polygon ou un solde en BNB sur BSC",
"or_alternatively_balance_on": "Ou alternativement, un solde en POL sur Polygon ou un solde en BNB sur BSC",
"fund_my_wallet": "Financer mon portefeuille"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/id_ID.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Semakin sering Anda menggunakan Rainbow, semakin banyak hadiah yang akan Anda dapatkan",
"balance_required": "Saldo dompet diperlukan",
"ensure_you_have_a_balance_on": "Untuk melanjutkan, pastikan Anda memiliki saldo ETH di salah satu jaringan berikut:",
"or_alternatively_balance_on": "Atau alternatifnya, saldo MATIC di Polygon atau saldo BNB di BSC",
"or_alternatively_balance_on": "Atau alternatifnya, saldo POL di Polygon atau saldo BNB di BSC",
"fund_my_wallet": "Isi Saldo Dompet"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/ja_JP.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Rainbowを使えば使うほど報酬が増えます",
"balance_required": "ウォレットの残高が必要です",
"ensure_you_have_a_balance_on": "続行するには、以下のネットワークのいずれかにETH残高があることを確認してください:",
"or_alternatively_balance_on": "または、Polygon上のMATIC残高、またはBSC上のBNB残高がある場合",
"or_alternatively_balance_on": "または、Polygon上のPOL残高、またはBSC上のBNB残高がある場合",
"fund_my_wallet": "マイウォレットに資金を入れる"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/ko_KR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Rainbow를 더 많이 사용할수록 더 많은 보상을 받게 됩니다",
"balance_required": "지갑 잔액 필요",
"ensure_you_have_a_balance_on": "계속하려면 다음 네트워크 중 하나에 ETH 잔액이 있는지 확인하세요:",
"or_alternatively_balance_on": "또는, Polygon에 MATIC 잔액 또는 BSC에 BNB 잔액",
"or_alternatively_balance_on": "또는, Polygon에 POL 잔액 또는 BSC에 BNB 잔액",
"fund_my_wallet": "지갑에 자금 추가"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/pt_BR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Quanto mais você usar o Rainbow, mais será recompensado",
"balance_required": "Saldo da carteira necessário",
"ensure_you_have_a_balance_on": "Para continuar, verifique se possui saldo em ETH em uma das seguintes redes:",
"or_alternatively_balance_on": "Ou alternativamente, saldo em MATIC na Polygon ou saldo em BNB na BSC",
"or_alternatively_balance_on": "Ou alternativamente, saldo em POL na Polygon ou saldo em BNB na BSC",
"fund_my_wallet": "Financiar Minha Carteira"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/ru_RU.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Чем больше вы используете Rainbow, тем больше будет награда",
"balance_required": "Требуется баланс кошелька",
"ensure_you_have_a_balance_on": "Для продолжения убедитесь, что у вас есть баланс ETH на одной из следующих сетей:",
"or_alternatively_balance_on": "Или, альтернативно, баланс MATIC на Polygon или баланс BNB на BSC",
"or_alternatively_balance_on": "Или, альтернативно, баланс POL на Polygon или баланс BNB на BSC",
"fund_my_wallet": "Пополнить мой кошелек"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/th_TH.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "ยิ่งใช้ Rainbow มากเท่าไหร่ ก็ยิ่งได้รับรางวัลมากขึ้น",
"balance_required": "ต้องมียอดเงินในกระเป๋า",
"ensure_you_have_a_balance_on": "เพื่อดำเนินการต่อ โปรดตรวจสอบว่าคุณมี ETH ในเครือข่ายต่อไปนี้:",
"or_alternatively_balance_on": "หรือมียอดเงิน MATIC บน Polygon หรือ BNB บน BSC",
"or_alternatively_balance_on": "หรือมียอดเงิน POL บน Polygon หรือ BNB บน BSC",
"fund_my_wallet": "เติมเงินเข้ากระเป๋า"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/tr_TR.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "Rainbow’u ne kadar çok kullanırsanız, o kadar çok ödül kazanırsınız",
"balance_required": "Cüzdan bakiyesi gerekiyor",
"ensure_you_have_a_balance_on": "Devam etmek için, aşağıdaki ağlardan birinde ETH bakiyeniz olduğundan emin olun:",
"or_alternatively_balance_on": "Veya alternatif olarak, Polygon'da MATIC veya BSC'de BNB bakiyeniz olsun",
"or_alternatively_balance_on": "Veya alternatif olarak, Polygon'da POL veya BSC'de BNB bakiyeniz olsun",
"fund_my_wallet": "Cüzdanımı Finanse Et"
},
"error": {
Expand Down
2 changes: 1 addition & 1 deletion static/json/languages/zh_CN.json
Original file line number Diff line number Diff line change
Expand Up @@ -1456,7 +1456,7 @@
"the_more_you_use": "越多使用Rainbow,越多奖励",
"balance_required": "需要钱包余额",
"ensure_you_have_a_balance_on": "继续操作前,请确保以下网络中有ETH余额:",
"or_alternatively_balance_on": "或者,Polygon上的MATIC余额或BSC上的BNB余额",
"or_alternatively_balance_on": "或者,Polygon上的POL余额或BSC上的BNB余额",
"fund_my_wallet": "资金进入我的钱包"
},
"error": {
Expand Down

0 comments on commit 00d7b45

Please sign in to comment.