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

feat: Add linea list #223

Merged
merged 4 commits into from
Aug 24, 2023
Merged
Show file tree
Hide file tree
Changes from all 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
Empty file added lists/images/linea/.gitkeep
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

should remove this file?

Copy link
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

for testing setup and later can add logo into it

Empty file.
57 changes: 57 additions & 0 deletions lists/pancakeswap-linea-default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"name": "PancakeSwap Linea Default",
"timestamp": "2023-08-24T03:02:01.934Z",
"version": {
"major": 0,
"minor": 0,
"patch": 3
},
"logoURI": "https://pancakeswap.finance/logo.png",
"keywords": [
"pancakeswap",
"default",
"linea"
],
"tokens": [
{
"name": "Wrapped Ether",
"symbol": "WETH",
"address": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
"chainId": 59144,
"decimals": 18,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/weth.png"
},
{
"name": "USD Coin",
"symbol": "USDC",
"address": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff",
"chainId": 59144,
"decimals": 6,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/usdc.png"
},
{
"name": "Tether USD",
"symbol": "USDT",
"address": "0xA219439258ca9da29E9Cc4cE5596924745e12B93",
"chainId": 59144,
"decimals": 6,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/usdt.png"
},
{
"name": "Dai Stablecoin",
"symbol": "DAI",
"address": "0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5",
"chainId": 59144,
"decimals": 18,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/dai.png"
},
{
"name": "Wrapped BTC",
"symbol": "WBTC",
"address": "0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4",
"chainId": 59144,
"decimals": 8,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/wbtc.png"
}
]
}
3 changes: 3 additions & 0 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,9 @@
"checksum:pcs-arbitrum-default": "yarn build && node ./dist checksum pancakeswap-arbitrum-default",
"generate:pcs-arbitrum-default": "yarn test --list=pancakeswap-arbitrum-default && yarn build && node ./dist generate pancakeswap-arbitrum-default",
"makelist:pcs-arbitrum-default": "yarn checksum:pcs-arbitrum-default && yarn generate:pcs-arbitrum-default",
"checksum:pcs-linea-default": "yarn build && node ./dist checksum pancakeswap-linea-default",
"generate:pcs-linea-default": "yarn test --list=pancakeswap-linea-default && yarn build && node ./dist generate pancakeswap-linea-default",
"makelist:pcs-linea-default": "yarn checksum:pcs-linea-default && yarn generate:pcs-linea-default",
"checksum:pcs-eth-mm": "yarn build && node ./dist checksum pancakeswap-eth-mm",
"generate:pcs-eth-mm": "yarn test --list=pancakeswap-eth-mm && yarn build && node ./dist generate pancakeswap-eth-mm",
"makelist:pcs-eth-mm": "yarn checksum:pcs-eth-mm && yarn generate:pcs-eth-mm",
Expand Down
10 changes: 10 additions & 0 deletions src/buildList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,14 @@ import { version as cmcVersion } from "../lists/cmc.json";
import { version as pancakeswapMiniVersion } from "../lists/pancakeswap-mini.json";
import { version as pancakeswapMiniExtendedVersion } from "../lists/pancakeswap-mini-extended.json";
import { version as pancakeswapArbitrumVersion } from "../lists/pancakeswap-arbitrum-default.json";
import { version as pancakeswapLineaVersion } from "../lists/pancakeswap-linea-default.json";
import { version as pancakeswapOnrampVersion } from "../lists/pancakeswap-onramp.json";
import pancakeswapAptos from "./tokens/pancakeswap-aptos.json";
import pancakeswapDefault from "./tokens/pancakeswap-default.json";
import pancakeswapPolygonZkevmDefault from "./tokens/pancakeswap-polygon-zkevm-default.json";
import pancakeswapZksyncDefault from "./tokens/pancakeswap-zksync-default.json";
import pancakeswapArbDefault from "./tokens/pancakeswap-arbitrum-default.json";
import pancakeswapLineaDefault from "./tokens/pancakeswap-linea-default.json";
import pancakeswapEthDefault from "./tokens/pancakeswap-eth-default.json";
import pancakeswapEthMM from "./tokens/pancakeswap-eth-mm.json";
import pancakeswapExtended from "./tokens/pancakeswap-extended.json";
Expand Down Expand Up @@ -64,6 +66,14 @@ const lists = {
sort: false,
currentVersion: pancakeswapZksyncDefaultVersion,
},
"pancakeswap-linea-default": {
list: pancakeswapLineaDefault,
name: "PancakeSwap Linea Default",
keywords: ["pancakeswap", "default", "linea"],
logoURI: "https://pancakeswap.finance/logo.png",
sort: false,
currentVersion: pancakeswapLineaVersion,
},
"pancakeswap-polygon-zkevm-default": {
list: pancakeswapPolygonZkevmDefault,
name: "PancakeSwap Zkevm Default",
Expand Down
2 changes: 2 additions & 0 deletions src/checksum.ts
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,7 @@ import { getAddress } from "@ethersproject/address";
import pancakeswapDefault from "./tokens/pancakeswap-default.json";
import pancakeswapEthDefault from "./tokens/pancakeswap-eth-default.json";
import pancakeswapZksyncDefault from "./tokens/pancakeswap-zksync-default.json";
import pancakeswapLineaDefault from "./tokens/pancakeswap-linea-default.json";
import pancakeswapPolygonZkevmDefault from "./tokens/pancakeswap-polygon-zkevm-default.json";
import pancakeswapArbitrumDefault from "./tokens/pancakeswap-arbitrum-default.json";
import pancakeswapEthMM from "./tokens/pancakeswap-eth-mm.json";
Expand All @@ -22,6 +23,7 @@ const lists = {
"pancakeswap-eth-default": pancakeswapEthDefault,
"pancakeswap-polygon-zkevm-default": pancakeswapPolygonZkevmDefault,
"pancakeswap-arbitrum-default": pancakeswapArbitrumDefault,
"pancakeswap-linea-default": pancakeswapLineaDefault,
"pancakeswap-zksync-default": pancakeswapZksyncDefault,
"pancakeswap-eth-mm": pancakeswapEthMM,
"pancakeswap-bnb-mm": pancakeswapBnbMM,
Expand Down
7 changes: 7 additions & 0 deletions src/ci-check.ts
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,7 @@ import srcEthDefault from "./tokens/pancakeswap-eth-default.json";
import srcPolygonZkevmDefault from "./tokens/pancakeswap-polygon-zkevm-default.json";
import srcArbitrumDefault from "./tokens/pancakeswap-arbitrum-default.json";
import srcZksyncDefault from "./tokens/pancakeswap-zksync-default.json";
import srcLineaDefault from "./tokens/pancakeswap-linea-default.json";
import srcExtended from "./tokens/pancakeswap-extended.json";
import srcTop100 from "./tokens/pancakeswap-top-100.json";
import srcTop15 from "./tokens/pancakeswap-top-15.json";
Expand All @@ -16,6 +17,7 @@ import defaultEthList from "../lists/pancakeswap-eth-default.json";
import defaultPolygonZkevmList from "../lists/pancakeswap-polygon-zkevm-default.json";
import defaultZksyncList from "../lists/pancakeswap-zksync-default.json";
import defaultArbitrumList from "../lists/pancakeswap-arbitrum-default.json";
import defaultLineaList from "../lists/pancakeswap-linea-default.json";
import extendedtList from "../lists/pancakeswap-extended.json";
import top15List from "../lists/pancakeswap-top-15.json";
import top100tList from "../lists/pancakeswap-top-100.json";
Expand Down Expand Up @@ -51,6 +53,11 @@ const lists = [
src: srcArbitrumDefault,
actual: defaultArbitrumList,
},
{
name: "pancakeswap-linea-default",
src: srcLineaDefault,
actual: defaultLineaList,
},
{
name: "pancakeswap-extended",
src: srcExtended,
Expand Down
1 change: 1 addition & 0 deletions src/fetchThirdPartyList.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const CMC_BAD_TOKENS = [
"0xcFA52F180538032402E0A2E702a4Da6fD1817fF5", // no a token
"0x199e5A83509F35CD5Eb38a2D28B56A7Cd658E337", // no a token
"0xBb6CD639724417A20a7db0F45C1fb2fE532f490A", // no a token
"0xCb73918ac58D0c90d71c7992637c61094c15305b", // self destruct
].map((a) => a.toLowerCase());

const badTokens = {
Expand Down
8 changes: 0 additions & 8 deletions src/tokens/cmc.json
Original file line number Diff line number Diff line change
Expand Up @@ -50927,14 +50927,6 @@
"decimals": 18,
"logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/19913.png"
},
{
"name": "Scorefam",
"symbol": "SFT",
"address": "0xCb73918ac58D0c90d71c7992637c61094c15305b",
"chainId": 56,
"decimals": 8,
"logoURI": "https://s2.coinmarketcap.com/static/img/coins/64x64/19914.png"
},
{
"name": "Crypto Snack",
"symbol": "SNACK",
Expand Down
42 changes: 42 additions & 0 deletions src/tokens/pancakeswap-linea-default.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,42 @@
[
{
"name": "Wrapped Ether",
"symbol": "WETH",
"address": "0xe5D7C2a44FfDDf6b295A15c148167daaAf5Cf34f",
"chainId": 59144,
"decimals": 18,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/weth.png"
},
{
"name": "USD Coin",
"symbol": "USDC",
"address": "0x176211869cA2b568f2A7D4EE941E073a821EE1ff",
"chainId": 59144,
"decimals": 6,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/usdc.png"
},
{
"name": "Tether USD",
"symbol": "USDT",
"address": "0xA219439258ca9da29E9Cc4cE5596924745e12B93",
"chainId": 59144,
"decimals": 6,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/usdt.png"
},
{
"name": "Dai Stablecoin",
"symbol": "DAI",
"address": "0x4AF15ec2A0BD43Db75dd04E62FAA3B8EF36b00d5",
"chainId": 59144,
"decimals": 18,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/dai.png"
},
{
"name": "Wrapped BTC",
"symbol": "WBTC",
"address": "0x3aAB2285ddcDdaD8edf438C1bAB47e1a9D05a9b4",
"chainId": 59144,
"decimals": 8,
"logoURI": "https://tokens.pancakeswap.finance/images/symbol/wbtc.png"
}
]
1 change: 1 addition & 0 deletions src/utils/multicall.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ const multicall = {
[1101]: "0xcA11bde05977b3631167028862bE2a173976CA11",
[324]: "0xF9cda624FBC7e059355ce98a31693d299FACd963",
[42161]: "0xcA11bde05977b3631167028862bE2a173976CA11",
[59144]: "0xcA11bde05977b3631167028862bE2a173976CA11",
};

interface MultiCall {
Expand Down
2 changes: 2 additions & 0 deletions src/utils/simpleRpcProvider.ts
Original file line number Diff line number Diff line change
Expand Up @@ -10,13 +10,15 @@ const ethRpcProvider = new ethers.providers.StaticJsonRpcProvider(ETH_RPC_URL, 1
const polygonZkevmRpcProvider = new ethers.providers.StaticJsonRpcProvider(POLYGON_ZKEVM_RPC_URL, 1101);
const zksyncRpcProvider = new ethers.providers.StaticJsonRpcProvider(ZKSYNC_RPC_URL, 324);
const arbitrumRpcProvider = new ethers.providers.StaticJsonRpcProvider("https://arb1.arbitrum.io/rpc", 42161);
const lineaRpcProvider = new ethers.providers.StaticJsonRpcProvider("https://rpc.linea.build", 59144);

const simpleRpcProvider = {
[1]: ethRpcProvider,
[56]: bscRpcProvider,
[1101]: polygonZkevmRpcProvider,
[324]: zksyncRpcProvider,
[42161]: arbitrumRpcProvider,
[59144]: lineaRpcProvider,
};

export default simpleRpcProvider;
11 changes: 11 additions & 0 deletions test/default.test.ts
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ import currentPancakeswapEthDefaultList from "../lists/pancakeswap-eth-default.j
import currentPancakeswapZksyncDefaultList from "../lists/pancakeswap-zksync-default.json";
import currentPancakeswapArbitrumDefaultList from "../lists/pancakeswap-arbitrum-default.json";
import currentPancakeswapPolygonZkevmDefaultList from "../lists/pancakeswap-polygon-zkevm-default.json";
import currentPancakeswapLineaDefaultList from "../lists/pancakeswap-linea-default.json";
import currentPancakeswapEthMMList from "../lists/pancakeswap-eth-mm.json";
import currentPancakeswapBnbMMList from "../lists/pancakeswap-bnb-mm.json";
import currentPancakeswapExtendedtList from "../lists/pancakeswap-extended.json";
Expand All @@ -34,6 +35,7 @@ const CASES = [
["pancakeswap-zksync-default"],
["pancakeswap-polygon-zkevm-default"],
["pancakeswap-arbitrum-default"],
["pancakeswap-linea-default"],
["pancakeswap-eth-mm"],
["pancakeswap-extended"],
["pancakeswap-top-100"],
Expand All @@ -54,6 +56,7 @@ const currentLists = {
"pancakeswap-bnb-mm": currentPancakeswapBnbMMList,
"pancakeswap-eth-default": currentPancakeswapEthDefaultList,
"pancakeswap-zksync-default": currentPancakeswapZksyncDefaultList,
"pancakeswap-linea-default": currentPancakeswapLineaDefaultList,
"pancakeswap-arbitrum-default": currentPancakeswapArbitrumDefaultList,
"pancakeswap-polygon-zkevm-default": currentPancakeswapPolygonZkevmDefaultList,
"pancakeswap-extended": currentPancakeswapExtendedtList,
Expand Down Expand Up @@ -92,6 +95,7 @@ const pathToEthImages = path.join(path.resolve(), "lists", "images", "eth");
const pathToZksyncImages = path.join(path.resolve(), "lists", "images", "zksync");
const pathToPolygonZkevmImages = path.join(path.resolve(), "lists", "images", "polygon-zkevm");
const pathToARbImages = path.join(path.resolve(), "lists", "images", "arbitrum");
const pathToLineaImages = path.join(path.resolve(), "lists", "images", "linea");

const logoFiles = fs
.readdirSync(pathToImages, { withFileTypes: true })
Expand All @@ -118,12 +122,18 @@ const pathToARbImagesLogoFiles = fs
.filter((f) => f.isFile())
.filter((f) => !/(^|\/)\.[^\/\.]/g.test(f.name));

const pathToLineaImagesLogoFiles = fs
.readdirSync(pathToLineaImages, { withFileTypes: true })
.filter((f) => f.isFile())
.filter((f) => !/(^|\/)\.[^\/\.]/g.test(f.name));

const multiChainLogoPath = {
[56]: "",
[1]: "/eth",
[1101]: "/polygon-zkevm",
[324]: "/zksync",
[42161]: "/arbitrum",
[59144]: "/linea",
};

const multiChainLogoFiles = {
Expand All @@ -132,6 +142,7 @@ const multiChainLogoFiles = {
[1101]: polygonZkevmLogoFiles,
[324]: polygonZksyncFiles,
[42161]: pathToARbImagesLogoFiles,
[59144]: pathToLineaImagesLogoFiles,
};

// Modified https://github.com/you-dont-need/You-Dont-Need-Lodash-Underscore#_get
Expand Down
Loading