Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Replace Rinkeby with Goerli for dev testing #15781

Merged
merged 3 commits into from
Sep 12, 2022
Merged
Show file tree
Hide file tree
Changes from 2 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 0 additions & 3 deletions app/_locales/de/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/el/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

6 changes: 3 additions & 3 deletions app/_locales/en/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/es/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/es_419/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/fr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/hi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/id/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ja/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ko/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/pt/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/pt_BR/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/ru/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tl/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/tr/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/vi/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/zh/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

3 changes: 0 additions & 3 deletions app/_locales/zh_CN/messages.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

30 changes: 15 additions & 15 deletions shared/constants/swaps.js
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ import {
POLYGON_CHAIN_ID,
MATIC_SYMBOL,
MATIC_TOKEN_IMAGE_URL,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
AVALANCHE_CHAIN_ID,
AVALANCHE_SYMBOL,
AVAX_TOKEN_IMAGE_URL,
Expand Down Expand Up @@ -66,7 +66,7 @@ export const TEST_ETH_SWAPS_TOKEN_OBJECT = {
iconUrl: TEST_ETH_TOKEN_IMAGE_URL,
};

export const RINKEBY_SWAPS_TOKEN_OBJECT = {
export const GOERLI_SWAPS_TOKEN_OBJECT = {
symbol: ETH_SYMBOL,
name: 'Ether',
address: DEFAULT_TOKEN_ADDRESS,
Expand All @@ -90,8 +90,8 @@ const AVALANCHE_CONTRACT_ADDRESS = '0x1a1ec25dc08e98e5e93f1104b5e5cdd298707d31';

export const WETH_CONTRACT_ADDRESS =
'0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2';
export const WETH_RINKEBY_CONTRACT_ADDRESS =
'0xc778417e063141139fce010982780140aa0cd5ab';
export const WETH_GOERLI_CONTRACT_ADDRESS =
'0xB4FBF271143F4FBf7B91A5ded31805e42b2208d6';
export const WBNB_CONTRACT_ADDRESS =
'0xbb4cdb9cbd36b01bd1cbaebf2de08d9173bc095c';
export const WMATIC_CONTRACT_ADDRESS =
Expand All @@ -110,7 +110,7 @@ export const GAS_DEV_API_BASE_URL =

const BSC_DEFAULT_BLOCK_EXPLORER_URL = 'https://bscscan.com/';
const MAINNET_DEFAULT_BLOCK_EXPLORER_URL = 'https://etherscan.io/';
const RINKEBY_DEFAULT_BLOCK_EXPLORER_URL = 'https://rinkeby.etherscan.io/';
const GOERLI_DEFAULT_BLOCK_EXPLORER_URL = 'https://goerli.etherscan.io/';
const POLYGON_DEFAULT_BLOCK_EXPLORER_URL = 'https://polygonscan.com/';
const AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL = 'https://snowtrace.io/';

Expand All @@ -124,20 +124,20 @@ export const ALLOWED_PROD_SWAPS_CHAIN_IDS = [

export const ALLOWED_DEV_SWAPS_CHAIN_IDS = [
...ALLOWED_PROD_SWAPS_CHAIN_IDS,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
];

export const ALLOWED_SMART_TRANSACTIONS_CHAIN_IDS = [
MAINNET_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
];

export const SWAPS_CHAINID_CONTRACT_ADDRESS_MAP = {
[MAINNET_CHAIN_ID]: MAINNET_CONTRACT_ADDRESS,
[SWAPS_TESTNET_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
[BSC_CHAIN_ID]: BSC_CONTRACT_ADDRESS,
[POLYGON_CHAIN_ID]: POLYGON_CONTRACT_ADDRESS,
[RINKEBY_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
[GOERLI_CHAIN_ID]: TESTNET_CONTRACT_ADDRESS,
[AVALANCHE_CHAIN_ID]: AVALANCHE_CONTRACT_ADDRESS,
};

Expand All @@ -146,7 +146,7 @@ export const SWAPS_WRAPPED_TOKENS_ADDRESSES = {
[SWAPS_TESTNET_CHAIN_ID]: WETH_CONTRACT_ADDRESS,
[BSC_CHAIN_ID]: WBNB_CONTRACT_ADDRESS,
[POLYGON_CHAIN_ID]: WMATIC_CONTRACT_ADDRESS,
[RINKEBY_CHAIN_ID]: WETH_RINKEBY_CONTRACT_ADDRESS,
[GOERLI_CHAIN_ID]: WETH_GOERLI_CONTRACT_ADDRESS,
[AVALANCHE_CHAIN_ID]: WAVAX_CONTRACT_ADDRESS,
};

Expand All @@ -159,9 +159,9 @@ export const ALLOWED_CONTRACT_ADDRESSES = {
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[SWAPS_TESTNET_CHAIN_ID],
SWAPS_WRAPPED_TOKENS_ADDRESSES[SWAPS_TESTNET_CHAIN_ID],
],
[RINKEBY_CHAIN_ID]: [
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[RINKEBY_CHAIN_ID],
SWAPS_WRAPPED_TOKENS_ADDRESSES[RINKEBY_CHAIN_ID],
[GOERLI_CHAIN_ID]: [
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[GOERLI_CHAIN_ID],
SWAPS_WRAPPED_TOKENS_ADDRESSES[GOERLI_CHAIN_ID],
],
[BSC_CHAIN_ID]: [
SWAPS_CHAINID_CONTRACT_ADDRESS_MAP[BSC_CHAIN_ID],
Expand All @@ -182,22 +182,22 @@ export const SWAPS_CHAINID_DEFAULT_TOKEN_MAP = {
[SWAPS_TESTNET_CHAIN_ID]: TEST_ETH_SWAPS_TOKEN_OBJECT,
[BSC_CHAIN_ID]: BNB_SWAPS_TOKEN_OBJECT,
[POLYGON_CHAIN_ID]: MATIC_SWAPS_TOKEN_OBJECT,
[RINKEBY_CHAIN_ID]: RINKEBY_SWAPS_TOKEN_OBJECT,
[GOERLI_CHAIN_ID]: GOERLI_SWAPS_TOKEN_OBJECT,
[AVALANCHE_CHAIN_ID]: AVAX_SWAPS_TOKEN_OBJECT,
};

export const SWAPS_CHAINID_DEFAULT_BLOCK_EXPLORER_URL_MAP = {
[BSC_CHAIN_ID]: BSC_DEFAULT_BLOCK_EXPLORER_URL,
[MAINNET_CHAIN_ID]: MAINNET_DEFAULT_BLOCK_EXPLORER_URL,
[POLYGON_CHAIN_ID]: POLYGON_DEFAULT_BLOCK_EXPLORER_URL,
[RINKEBY_CHAIN_ID]: RINKEBY_DEFAULT_BLOCK_EXPLORER_URL,
[GOERLI_CHAIN_ID]: GOERLI_DEFAULT_BLOCK_EXPLORER_URL,
[AVALANCHE_CHAIN_ID]: AVALANCHE_DEFAULT_BLOCK_EXPLORER_URL,
};

export const ETHEREUM = 'ethereum';
export const POLYGON = 'polygon';
export const BSC = 'bsc';
export const RINKEBY = 'rinkeby';
export const GOERLI = 'goerli';
export const AVALANCHE = 'avalanche';

export const SWAPS_CLIENT_ID = 'extension';
Expand Down
6 changes: 3 additions & 3 deletions ui/ducks/swaps/swaps.test.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ import { setSwapsLiveness, setSwapsFeatureFlags } from '../../store/actions';
import { setStorageItem } from '../../helpers/utils/storage-helpers';
import {
MAINNET_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
} from '../../../shared/constants/network';
Expand Down Expand Up @@ -280,9 +280,9 @@ describe('Ducks - Swaps', () => {
expect(swaps.getSmartTransactionsEnabled(state)).toBe(false);
});

it('returns true if feature flag is enabled, not a HW and is Rinkeby network', () => {
it('returns true if feature flag is enabled, not a HW and is Goerli network', () => {
const state = createSwapsMockStore();
state.metamask.provider.chainId = RINKEBY_CHAIN_ID;
state.metamask.provider.chainId = GOERLI_CHAIN_ID;
expect(swaps.getSmartTransactionsEnabled(state)).toBe(true);
});

Expand Down
10 changes: 9 additions & 1 deletion ui/hooks/useTokensToSearch.js
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ import {
BSC_CHAIN_ID,
POLYGON_CHAIN_ID,
AVALANCHE_CHAIN_ID,
GOERLI_CHAIN_ID,
} from '../../shared/constants/network';
import { useEqualityCheck } from './useEqualityCheck';

Expand Down Expand Up @@ -66,13 +67,20 @@ export function getRenderableTokenData(
)
: '';

const chainIdForTokenIcons =
chainId === GOERLI_CHAIN_ID ? MAINNET_CHAIN_ID : chainId;

const tokenIconUrl =
(symbol === ETH_SYMBOL && chainId === MAINNET_CHAIN_ID) ||
(symbol === ETH_SYMBOL && chainId === GOERLI_CHAIN_ID) ||
(symbol === BNB_SYMBOL && chainId === BSC_CHAIN_ID) ||
(symbol === MATIC_SYMBOL && chainId === POLYGON_CHAIN_ID) ||
(symbol === AVALANCHE_SYMBOL && chainId === AVALANCHE_CHAIN_ID)
? iconUrl
: formatIconUrlWithProxy({ chainId, tokenAddress: address || '' });
: formatIconUrlWithProxy({
chainId: chainIdForTokenIcons,
tokenAddress: address || '',
});
const usedIconUrl = tokenIconUrl || token?.image;

return {
Expand Down
6 changes: 3 additions & 3 deletions ui/pages/swaps/fee-card/fee-card.js
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@ import {
BSC_CHAIN_ID,
LOCALHOST_CHAIN_ID,
POLYGON_CHAIN_ID,
RINKEBY_CHAIN_ID,
GOERLI_CHAIN_ID,
AVALANCHE_CHAIN_ID,
} from '../../../../shared/constants/network';
import TransactionDetail from '../../../components/app/transaction-detail/transaction-detail.component';
Expand Down Expand Up @@ -48,8 +48,8 @@ export default function FeeCard({
return t('networkNamePolygon');
case LOCALHOST_CHAIN_ID:
return t('networkNameTestnet');
case RINKEBY_CHAIN_ID:
return t('networkNameRinkeby');
case GOERLI_CHAIN_ID:
return t('networkNameGoerli');
case AVALANCHE_CHAIN_ID:
return t('networkNameAvalanche');
default:
Expand Down
Loading