diff --git a/src/buildList.js b/src/buildList.js index 899b40d0..98d6f91a 100644 --- a/src/buildList.js +++ b/src/buildList.js @@ -10,6 +10,7 @@ const neon = require("./tokens/neon.json"); const taiko = require("./tokens/taiko.json"); const storyIliad = require("./tokens/story_iliad.json"); const storyOdyssey = require("./tokens/story_odyssey.json"); +const morph = require("./tokens/morph.json"); // pairs const basePairs = require("./pairs/base.json"); @@ -23,6 +24,7 @@ const neonPairs = require("./pairs/neon.json"); const taikoPairs = require("./pairs/taiko.json"); const storyIliadPairs = require("./pairs/story_iliad.json"); const storyOdysseyPairs = require("./pairs/story_odyssey.json"); +const morphPairs = require("./pairs/morph.json"); const bridgeUtils = require("@uniswap/token-list-bridge-utils"); @@ -136,6 +138,15 @@ module.exports = function buildList() { decimals: 18, logoURI: "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png", }, + Morph: { + "chainId": 2818, + "address": "0x5300000000000000000000000000000000000011", + "name": "Ether", + "symbol": "ETH", + "decimals": 18, + "cgId": "ethereum", + "logoURI": "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png" + }, }, // List stablecoins with top market cap on each chain stablecoins: { @@ -333,6 +344,35 @@ module.exports = function buildList() { logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png", }, ], + Morph: [ + { + "chainId": 2818, + "address": "0xc7D67A9cBB121b3b0b9c053DD9f469523243379A", + "name": "Tether USD", + "symbol": "USDT", + "decimals": 18, + "cgId": "tether", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDT.svg" + }, + { + "chainId": 2818, + "address": "0xe34c91815d7fc18A9e2148bcD4241d0a5848b693", + "name": "USD Coin", + "symbol": "USDC", + "decimals": 6, + "cgId": "usd-coin", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDC.svg" + }, + { + "chainId": 2818, + "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "name": "Dai", + "symbol": "DAI", + "decimals": 18, + "cgId": "dai", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/DAI.svg" + } + ] }, defaultPair: { Base: { @@ -538,6 +578,27 @@ module.exports = function buildList() { logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png", }, }, + Morph: { + "base": { + "chainId": 2818, + "address": "0x5300000000000000000000000000000000000011", + "name": "Ether", + "symbol": "ETH", + "decimals": 18, + "cgId": "ethereum", + "logoURI": "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png" + }, + "quote": { + "chainId": 2818, + "address": "0xc7D67A9cBB121b3b0b9c053DD9f469523243379A", + "name": "Tether USD", + "symbol": "USDT", + "decimals": 18, + "cgId": "tether", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDT.svg" + }, + "listing_price": 3347.96 + }, }, scannerLink: { Base: "https://basescan.org/", @@ -552,6 +613,7 @@ module.exports = function buildList() { "Story Public Testnet": "https://testnet.storyscan.xyz/", "Story Odyssey Testnet": "https://odyssey-testnet-explorer.storyscan.xyz/", + Morph: "https://explorer.morphl2.io/", }, matchingEngine: { Base: { @@ -598,6 +660,10 @@ module.exports = function buildList() { address: "0x8c1F7817657aAe22E22ce84d552fE0C01bD8A254", startBlock: 440605, }, + "Morph": { + address: "0xd7ABA1cbAd246249be6a0de9a449FB5EDEFf1E47", + startBlock: 556889, + }, }, tags: {}, logoURI: "https://avatars.githubusercontent.com/u/73440097?s=200&v=4", @@ -614,6 +680,7 @@ module.exports = function buildList() { ...taiko, ...storyIliad, ...storyOdyssey, + ...morph, ] // sort them by symbol for easy readability .sort((t1, t2) => { @@ -634,6 +701,7 @@ module.exports = function buildList() { ...taikoPairs, ...storyIliadPairs, ...storyOdysseyPairs, + ...morphPairs, ], }; return bridgeUtils.chainify(l1List); diff --git a/src/const/customChains.js b/src/const/customChains.js index b6d0ad3a..cbdfda03 100644 --- a/src/const/customChains.js +++ b/src/const/customChains.js @@ -58,4 +58,34 @@ const StoryOdyssey = defineChain({ }, }); -module.exports = { StoryOdyssey, StoryIliad }; +const Morph = defineChain({ + id: 2818, + name: "Morph", + nativeCurrency: { name: "Ether", symbol: "ETH", decimals: 18 }, + rpcUrls: { + public: { http: ["https://rpc.morphl2.io"] }, + default: { + http: ["https://rpc.morphl2.io"], + }, + }, + blockExplorers: { + etherscan: { + name: "Morph Scan", + url: "https://explorer.morphl2.io", + }, + default: { + name: "Morph Scan", + url: "https://explorer.morphl2.io", + }, + }, + testnet: false, + contracts: { + multicall3: { + address: "0x35f965903A85e7528437C3Ce0b4bdfbc4E5Fc27c", + blockCreated: + 52602, + }, + }, +}) + +module.exports = { StoryOdyssey, StoryIliad, Morph }; diff --git a/src/const/index.js b/src/const/index.js index c3d4c408..17016679 100644 --- a/src/const/index.js +++ b/src/const/index.js @@ -23,6 +23,7 @@ const ChainIds = { "Taiko Mainnet": 167000, "Story Public Testnet": 1513, "Story Odyssey Testnet": 1516, + "Morph Mainnet": 2818, }; module.exports = { ChainIds } \ No newline at end of file diff --git a/src/pairs/morph.json b/src/pairs/morph.json new file mode 100644 index 00000000..df061b51 --- /dev/null +++ b/src/pairs/morph.json @@ -0,0 +1,143 @@ +[ + { + "base": { + "chainId": 2818, + "address": "0x5300000000000000000000000000000000000011", + "name": "Ether", + "symbol": "ETH", + "decimals": 18, + "cgId": "ethereum", + "logoURI": "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png" + }, + "quote": { + "chainId": 2818, + "address": "0xc7D67A9cBB121b3b0b9c053DD9f469523243379A", + "name": "Tether USD", + "symbol": "USDT", + "decimals": 18, + "cgId": "tether", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDT.svg" + }, + "listing_price": 3347.96 + }, + { + "base": { + "chainId": 2818, + "address": "0x803DcE4D3f4Ae2e17AF6C51343040dEe320C149D", + "symbol": "BTC", + "name": "Wrapped Bitcoin", + "decimals": 18, + "logoURI": "https://raw.githubusercontent.com/ubeswap/default-token-list/master/assets/asset_WBTC.png" + }, + "quote": { + "chainId": 2818, + "address": "0x5300000000000000000000000000000000000011", + "name": "Ether", + "symbol": "ETH", + "decimals": 18, + "cgId": "ethereum", + "logoURI": "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png" + }, + "listing_price": 29.18 + }, + { + "base": { + "chainId": 2818, + "address": "0x803DcE4D3f4Ae2e17AF6C51343040dEe320C149D", + "symbol": "BTC", + "name": "Wrapped Bitcoin", + "decimals": 18, + "logoURI": "https://raw.githubusercontent.com/ubeswap/default-token-list/master/assets/asset_WBTC.png" + }, + "quote": { + "chainId": 2818, + "address": "0xe34c91815d7fc18A9e2148bcD4241d0a5848b693", + "name": "USD Coin", + "symbol": "USDC", + "decimals": 6, + "cgId": "usd-coin", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDC.svg" + }, + "listing_price": 97736.38 + }, + { + "base": { + "chainId": 2818, + "address": "0x803DcE4D3f4Ae2e17AF6C51343040dEe320C149D", + "symbol": "BTC", + "name": "Wrapped Bitcoin", + "decimals": 18, + "logoURI": "https://raw.githubusercontent.com/ubeswap/default-token-list/master/assets/asset_WBTC.png" + }, + "quote": { + "chainId": 2818, + "address": "0xc7D67A9cBB121b3b0b9c053DD9f469523243379A", + "name": "Tether USD", + "symbol": "USDT", + "decimals": 18, + "cgId": "tether", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDT.svg" + }, + "listing_price": 97736.38 + }, + { + "base": { + "chainId": 2818, + "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "symbol": "DAI", + "name": "Dai", + "decimals": 18, + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/DAI.svg" + }, + "quote": { + "chainId": 2818, + "address": "0x5300000000000000000000000000000000000011", + "name": "Ether", + "symbol": "ETH", + "decimals": 18, + "cgId": "ethereum", + "logoURI": "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png" + }, + "listing_price": 0.00030 + }, + { + "base": { + "chainId": 2818, + "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "symbol": "DAI", + "name": "Dai", + "decimals": 18, + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/DAI.svg" + }, + "quote": { + "chainId": 2818, + "address": "0xe34c91815d7fc18A9e2148bcD4241d0a5848b693", + "name": "USD Coin", + "symbol": "USDC", + "decimals": 6, + "cgId": "usd-coin", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDC.svg" + }, + "listing_price": 1 + }, + { + "base": { + "chainId": 2818, + "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "symbol": "DAI", + "name": "Dai", + "decimals": 18, + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/DAI.svg" + }, + "quote": { + "chainId": 2818, + "address": "0xc7D67A9cBB121b3b0b9c053DD9f469523243379A", + "name": "Tether USD", + "symbol": "USDT", + "decimals": 18, + "cgId": "tether", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDT.svg" + }, + "listing_price": 1 + } +] diff --git a/src/pairs/story_odyssey.json b/src/pairs/story_odyssey.json index 1726cdd4..956cb23a 100644 --- a/src/pairs/story_odyssey.json +++ b/src/pairs/story_odyssey.json @@ -25,7 +25,7 @@ "symbol": "WBTC", "name": "Wrapped Bitcoin", "decimals": 8, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/7598/standard/wrapped_bitcoin_wbtc.png?1696507857" }, "quote": { "chainId": 1516, @@ -44,7 +44,7 @@ "symbol": "WBTC", "name": "Wrapped Bitcoin", "decimals": 8, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/7598/standard/wrapped_bitcoin_wbtc.png?1696507857" }, "quote": { "chainId": 1516, @@ -63,7 +63,7 @@ "symbol": "WBTC", "name": "Wrapped Bitcoin", "decimals": 8, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/7598/standard/wrapped_bitcoin_wbtc.png?1696507857" }, "quote": { "address": "0x02F75bdBb4732cc6419aC15EeBeE6BCee66e826f", @@ -71,7 +71,7 @@ "name": "Tether USD", "symbol": "USDT", "decimals": 6, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/325/standard/Tether.png?1696501661" }, "listing_price": 7850.453 }, @@ -82,7 +82,7 @@ "symbol": "WETH", "name": "Wrapped Ether", "decimals": 18, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332" }, "quote": { "chainId": 1516, @@ -101,7 +101,7 @@ "symbol": "WETH", "name": "Wrapped Ether", "decimals": 18, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332" }, "quote": { "chainId": 1516, @@ -120,7 +120,7 @@ "symbol": "WETH", "name": "Wrapped Ether", "decimals": 18, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332" }, "quote": { "address": "0x02F75bdBb4732cc6419aC15EeBeE6BCee66e826f", @@ -128,7 +128,7 @@ "name": "Tether USD", "symbol": "USDT", "decimals": 6, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/325/standard/Tether.png?1696501661" }, "listing_price": 957.9362 } diff --git a/src/scripts/addPairs.js b/src/scripts/addPairs.js index 16267a5c..09f106e3 100644 --- a/src/scripts/addPairs.js +++ b/src/scripts/addPairs.js @@ -1,6 +1,6 @@ const { createWalletClient, http, parseUnits } = require("viem"); const { privateKeyToAccount } = require("viem/accounts"); -const { StoryIliad, StoryOdyssey } = require("../const/customChains"); +const { StoryIliad, StoryOdyssey, Morph } = require("../const/customChains"); const { base, kroma, @@ -9,16 +9,16 @@ const { neonMainnet, taiko, } = require("viem/chains"); -const { ChainIds } = require("../const"); const MatchingEngineABI = require("../abis/MatchingEngineABI"); const defaultTokenList = require("../../build/standard-default.tokenlist.json"); require("dotenv").config(); -async function getPairs(networkName) { +async function getPairs(network) { try { - const chainId = ChainIds[networkName]; + console.log("Getting pairs for network:", network.name, network.chainId); + const chainId = network.id; const pairs = defaultTokenList.pairs.filter( - (pair) => pair.base.chainId == chainId + (pair) => pair.base.chainId === chainId ); return pairs; } catch (error) { @@ -76,18 +76,20 @@ async function main() { const account = privateKeyToAccount(process.env.ADMIN_PRIVATE_KEY); const walletClient = createWalletClient({ account, - chain: StoryOdyssey, + // Change network to configure pair list to add in a network + chain: Morph, transport: http(process.env.STORY_ODYSSEY_RPC), }); const abi = MatchingEngineABI; - const pairs = await getPairs("Story Odyssey Testnet"); + // Change network to configure pair list to add in a network + const pairs = await getPairs(Morph); console.log("Pairs to add:", pairs.length); // make contract call on each pair in the list const matchingEngine = - defaultTokenList.matchingEngine["Story Odyssey Testnet"].address; + defaultTokenList.matchingEngine.Morph.address; for (const pair of pairs) { await addPair(pair, matchingEngine, walletClient, abi); diff --git a/src/scripts/generateDefaultPairs.js b/src/scripts/generateDefaultPairs.js index 85df4252..3a4febd5 100644 --- a/src/scripts/generateDefaultPairs.js +++ b/src/scripts/generateDefaultPairs.js @@ -1,5 +1,5 @@ // replace path with path to desired network tokenlist -const tokenlist = require("../tokens/story_odyssey.json"); +const tokenlist = require("../tokens/morph.json"); function sleep(ms) { return new Promise((resolve) => setTimeout(resolve, ms)); @@ -28,7 +28,7 @@ async function getCoinPrice(coinId) { async function adddefaultPairs() { const stablecoin2 = tokenlist.find((token) => token.symbol === "USDT"); const stablecoin = tokenlist.find((token) => token.symbol === "USDC"); - const eth = tokenlist.find((token) => token.symbol === "IP"); + const eth = tokenlist.find((token) => token.symbol === "ETH"); const remainingTokens = tokenlist.filter( (token) => diff --git a/src/tokens/morph.json b/src/tokens/morph.json new file mode 100644 index 00000000..1352a6dc --- /dev/null +++ b/src/tokens/morph.json @@ -0,0 +1,47 @@ +[ + { + "chainId": 2818, + "address": "0xc7D67A9cBB121b3b0b9c053DD9f469523243379A", + "name": "Tether USD", + "symbol": "USDT", + "decimals": 18, + "cgId": "tether", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDT.svg" + }, + { + "chainId": 2818, + "address": "0x803DcE4D3f4Ae2e17AF6C51343040dEe320C149D", + "name": "Wrapped Bitcoin", + "symbol": "BTC", + "decimals": 18, + "cgId": "bitcoin", + "logoURI": "https://raw.githubusercontent.com/ubeswap/default-token-list/master/assets/asset_WBTC.png" + }, + { + "chainId": 2818, + "address": "0x5300000000000000000000000000000000000011", + "name": "Ether", + "symbol": "ETH", + "decimals": 18, + "cgId": "ethereum", + "logoURI": "https://s2.coinmarketcap.com/static/img/coins/128x128/1027.png" + }, + { + "chainId": 2818, + "address": "0xe34c91815d7fc18A9e2148bcD4241d0a5848b693", + "name": "USD Coin", + "symbol": "USDC", + "decimals": 6, + "cgId": "usd-coin", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/USDC.svg" + }, + { + "chainId": 2818, + "address": "0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063", + "name": "Dai", + "symbol": "DAI", + "decimals": 18, + "cgId": "dai", + "logoURI": "https://raw.githubusercontent.com/morph-l2/morph-list/main/tokenIcons/DAI.svg" + } +] diff --git a/src/tokens/story_odyssey.json b/src/tokens/story_odyssey.json index f0a451e5..499008bc 100644 --- a/src/tokens/story_odyssey.json +++ b/src/tokens/story_odyssey.json @@ -21,7 +21,7 @@ "name": "Tether USD", "symbol": "USDT", "decimals": 6, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/325/standard/Tether.png?1696501661" }, { "address": "0x656afb1968bC39Cf3937f68CC6089F10cf47C1F7", @@ -29,7 +29,7 @@ "name": "Wrapped Bitcoin", "symbol": "WBTC", "decimals": 8, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/7598/standard/wrapped_bitcoin_wbtc.png?1696507857" }, { "address": "0x1C13B2B65d55dF06FF43528E736Db2F8e372E692", @@ -37,6 +37,6 @@ "name": "Wrapped Ether", "symbol": "WETH", "decimals": 18, - "logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png" + "logoURI": "https://assets.coingecko.com/coins/images/2518/standard/weth.png?1696503332" } ] \ No newline at end of file