Skip to content

Commit

Permalink
Auto-Not-So-Matic: Fix two matic.network URLs to polygon.technology (#…
Browse files Browse the repository at this point in the history
…3483)

Looks like matic.network has been fully decommissioned, and for both gas
prices and for the PoS WETH asset, we were relying on it. Move to
polygon.technology equivalents.

In practice, the asset SVG for PoS WETH won't be used because newer
versions of the Polygon token lists don't include the broken WETH asset
that we were substituting in. We keep it because it's referenced in a
migration and I would rather not try to figure out if it's safe to kill
the migration for now.

## Testing

- [x] Switch to Polygon
- [x] Try to send an asset. You should be able to get to the send
transaction screen with a populated gas price.
- [x] Look up ETH under the swap target while on Polygon and make sure
you see ![](https://assets.polygon.technology/tokenAssets/eth.svg) as
the icon. The changes in this PR shouldn't really affect this, but might
as well check!

Fixes #3482 .

Latest build:
[extension-builds-3483](https://github.com/tahowallet/extension/suites/13645026026/artifacts/753192433)
(as of Fri, 16 Jun 2023 00:51:51 GMT).
  • Loading branch information
jagodarybacka committed Jun 16, 2023
2 parents c8cb3e9 + b2f859d commit f6b9c1f
Show file tree
Hide file tree
Showing 3 changed files with 2 additions and 8 deletions.
2 changes: 1 addition & 1 deletion background/lib/gas.ts
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ type PolygonGasResponse = {
const getPolygonGasPrices = async (price: bigint): Promise<BlockPrices> => {
// @TODO Validate this response using ajv
const gasEstimates = (await fetchJson(
"https://gasstation-mainnet.matic.network/v2"
"https://gasstation.polygon.technology/v2"
)) as PolygonGasResponse

const baseFeePerGas = BigInt(Math.ceil(gasEstimates.estimatedBaseFee * 1e9))
Expand Down
6 changes: 0 additions & 6 deletions background/services/indexing/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,6 @@ import {
normalizeEVMAddress,
sameEVMAddress,
} from "../../lib/utils"
import { fixPolygonWETHIssue, polygonTokenListURL } from "./token-list-edit"

// Transactions seen within this many blocks of the chain tip will schedule a
// token refresh sooner than the standard rate.
Expand Down Expand Up @@ -911,11 +910,6 @@ export default class IndexingService extends BaseService<Events> {
try {
const newListRef = await fetchAndValidateTokenList(url)

if (url === polygonTokenListURL) {
newListRef.tokenList.tokens = fixPolygonWETHIssue(
newListRef.tokenList.tokens
)
}
await this.db.saveTokenList(url, newListRef.tokenList)
} catch (err) {
logger.error(
Expand Down
2 changes: 1 addition & 1 deletion background/services/indexing/token-list-edit.ts
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ export function fixPolygonWETHIssue(tokensParam: TokenInfo[]): TokenInfo[] {
...tokens[tokenToRenameIndex],
name: "Wrapped Ether",
symbol: "WETH",
logoURI: "https://wallet-asset.matic.network/img/tokens/weth.svg",
logoURI: "https://assets.polygon.technology/tokenAssets/eth.svg",
}
}

Expand Down

0 comments on commit f6b9c1f

Please sign in to comment.