Skip to content

Commit

Permalink
add story odyssey
Browse files Browse the repository at this point in the history
  • Loading branch information
hskang9 committed Nov 9, 2024
1 parent 723be89 commit a583939
Show file tree
Hide file tree
Showing 7 changed files with 275 additions and 22 deletions.
74 changes: 60 additions & 14 deletions src/buildList.js
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,11 @@ const morphHolesky = require("./tokens/morph_holesky.json");
const metal = require("./tokens/metal.json");
const fraxtal = require("./tokens/fraxtal.json");
const mode = require("./tokens/mode.json");
const scroll = require("./tokens/scroll.json");
const scroll = require("./tokens/scroll.json");
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");

// pairs
const basePairs = require("./pairs/base.json");
Expand All @@ -21,6 +22,7 @@ const scrollPairs = require("./pairs/scroll.json");
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 bridgeUtils = require("@uniswap/token-list-bridge-utils");

Expand Down Expand Up @@ -126,6 +128,14 @@ module.exports = function buildList() {
decimals: 18,
logoURI: "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png",
},
"Story Odyssey Testnet": {
chainId: 1516,
address: "0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5",
name: "IP",
symbol: "IP",
decimals: 18,
logoURI: "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png",
},
},
// List stablecoins with top market cap on each chain
stablecoins: {
Expand All @@ -145,7 +155,7 @@ module.exports = function buildList() {
symbol: "USDbC",
decimals: 6,
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
}
},
],
Kroma: [
{
Expand Down Expand Up @@ -313,6 +323,16 @@ module.exports = function buildList() {
logoURI: "https://ethereum-optimism.github.io/data/USDT/logo.png",
},
],
"Story Odyssey Testnet": [
{
chainId: 1516,
address: "0xF1815bd50389c46847f0Bda824eC8da914045D14",
name: "USD Coin",
symbol: "USDC",
decimals: 6,
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
},
],
},
defaultPair: {
Base: {
Expand Down Expand Up @@ -500,6 +520,24 @@ module.exports = function buildList() {
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
},
},
"Story Odyssey Testnet": {
base: {
chainId: 1516,
address: "0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5",
name: "IP",
symbol: "IP",
decimals: 18,
logoURI: "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png",
},
quote: {
chainId: 1516,
address: "0xF1815bd50389c46847f0Bda824eC8da914045D14",
name: "USD Coin",
symbol: "USDC",
decimals: 6,
logoURI: "https://ethereum-optimism.github.io/data/USDC/logo.png",
},
},
},
scannerLink: {
Base: "https://basescan.org/",
Expand All @@ -512,6 +550,8 @@ module.exports = function buildList() {
"Neon EVM MainNet": "https://neonscan.org/",
"Taiko Mainnet": "https://taikoscan.io/",
"Story Public Testnet": "https://testnet.storyscan.xyz/",
"Story Odyssey Testnet":
"https://odyssey-testnet-explorer.storyscan.xyz/",
},
matchingEngine: {
Base: {
Expand Down Expand Up @@ -554,6 +594,10 @@ module.exports = function buildList() {
address: "0x9140Ea931a0A33c2804540122EC632d0a08e9D2e",
startBlock: 1610258,
},
"Story Odyssey Testnet": {
address: "0xd7ABA1cbAd246249be6a0de9a449FB5EDEFf1E47",
startBlock: 365748,
},
},
stndxp: {
Base: {
Expand Down Expand Up @@ -600,18 +644,6 @@ module.exports = function buildList() {
tags: {},
logoURI: "https://avatars.githubusercontent.com/u/73440097?s=200&v=4",
keywords: ["standard", "default"],
pairs: [
...basePairs,
...kromaPairs,
...morphHoleskyPairs,
...modePairs,
...fraxtalPairs,
...metalPairs,
...scrollPairs,
...neonPairs,
...taikoPairs,
...storyIliadPairs,
],
tokens: [
...base,
...kroma,
Expand All @@ -623,6 +655,7 @@ module.exports = function buildList() {
...neon,
...taiko,
...storyIliad,
...storyOdyssey,
]
// sort them by symbol for easy readability
.sort((t1, t2) => {
Expand All @@ -631,6 +664,19 @@ module.exports = function buildList() {
}
return t1.chainId < t2.chainId ? -1 : 1;
}),
pairs: [
...basePairs,
...kromaPairs,
...morphHoleskyPairs,
...modePairs,
...fraxtalPairs,
...metalPairs,
...scrollPairs,
...neonPairs,
...taikoPairs,
...storyIliadPairs,
...storyOdysseyPairs,
],
};
return bridgeUtils.chainify(l1List);
};
32 changes: 30 additions & 2 deletions src/const/customChains.js
Original file line number Diff line number Diff line change
@@ -1,4 +1,3 @@

const { defineChain } = require("viem");

const StoryIliad = defineChain({
Expand Down Expand Up @@ -30,4 +29,33 @@ const StoryIliad = defineChain({
},
});

module.exports = { StoryIliad }
const StoryOdyssey = defineChain({
id: 1516,
name: "Story Odyssey Testnet",
nativeCurrency: { name: "IP", symbol: "IP", decimals: 18 },
rpcUrls: {
public: { http: ["https://rpc.odyssey.storyrpc.io/"] },
default: {
http: ["https://rpc.odyssey.storyrpc.io/"],
},
},
blockExplorers: {
etherscan: {
name: "Story Odyssey Testnet Scan",
url: "https://odyssey-testnet-explorer.storyscan.xyz/",
},
default: {
name: "Story Odyssey Testnet Scan",
url: "https://odyssey-testnet-explorer.storyscan.xyz/",
},
},
testnet: true,
contracts: {
multicall3: {
address: "0xcA11bde05977b3631167028862bE2a173976CA11",
blockCreated: 14880,
},
},
});

module.exports = { StoryOdyssey, StoryIliad };
1 change: 1 addition & 0 deletions src/const/index.js
Original file line number Diff line number Diff line change
Expand Up @@ -22,6 +22,7 @@ const ChainIds = {
"Scroll": 534352,
"Taiko Mainnet": 167000,
"Story Public Testnet": 1513,
"Story Odyssey Testnet": 1516,
};

module.exports = { ChainIds }
136 changes: 136 additions & 0 deletions src/pairs/story_odyssey.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,136 @@
[
{
"base": {
"chainId": 1516,
"address": "0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5",
"name": "IP",
"symbol": "IP",
"decimals": 18,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"chainId": 1516,
"address": "0x40fCa9cB1AB15eD9B5bDA19A52ac00A78AE08e1D",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png"
},
"listing_price": 23895.309
},
{
"base": {
"chainId": 1516,
"address": "0x656afb1968bC39Cf3937f68CC6089F10cf47C1F7",
"symbol": "WBTC",
"name": "Wrapped Bitcoin",
"decimals": 8,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"chainId": 1516,
"address": "0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5",
"name": "IP",
"symbol": "IP",
"decimals": 18,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"listing_price": 36.06891
},
{
"base": {
"chainId": 1516,
"address": "0x656afb1968bC39Cf3937f68CC6089F10cf47C1F7",
"symbol": "WBTC",
"name": "Wrapped Bitcoin",
"decimals": 8,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"chainId": 1516,
"address": "0x40fCa9cB1AB15eD9B5bDA19A52ac00A78AE08e1D",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png"
},
"listing_price": 7850.453
},
{
"base": {
"chainId": 1516,
"address": "0x656afb1968bC39Cf3937f68CC6089F10cf47C1F7",
"symbol": "WBTC",
"name": "Wrapped Bitcoin",
"decimals": 8,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"address": "0x02F75bdBb4732cc6419aC15EeBeE6BCee66e826f",
"chainId": 1516,
"name": "Tether USD",
"symbol": "USDT",
"decimals": 6,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"listing_price": 7850.453
},
{
"base": {
"chainId": 1516,
"address": "0x1C13B2B65d55dF06FF43528E736Db2F8e372E692",
"symbol": "WETH",
"name": "Wrapped Ether",
"decimals": 18,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"chainId": 1516,
"address": "0xe8CabF9d1FFB6CE23cF0a86641849543ec7BD7d5",
"name": "IP",
"symbol": "IP",
"decimals": 18,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"listing_price": 9.120432
},
{
"base": {
"chainId": 1516,
"address": "0x1C13B2B65d55dF06FF43528E736Db2F8e372E692",
"symbol": "WETH",
"name": "Wrapped Ether",
"decimals": 18,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"chainId": 1516,
"address": "0x40fCa9cB1AB15eD9B5bDA19A52ac00A78AE08e1D",
"name": "USD Coin",
"symbol": "USDC",
"decimals": 6,
"logoURI": "https://ethereum-optimism.github.io/data/USDC/logo.png"
},
"listing_price": 957.9362
},
{
"base": {
"chainId": 1516,
"address": "0x1C13B2B65d55dF06FF43528E736Db2F8e372E692",
"symbol": "WETH",
"name": "Wrapped Ether",
"decimals": 18,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"quote": {
"address": "0x02F75bdBb4732cc6419aC15EeBeE6BCee66e826f",
"chainId": 1516,
"name": "Tether USD",
"symbol": "USDT",
"decimals": 6,
"logoURI": "https://app.piperx.xyz/assets/icon_Story-0eb3cd42.png"
},
"listing_price": 957.9362
}
]

10 changes: 5 additions & 5 deletions src/scripts/addPairs.js
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
const { createWalletClient, http, parseUnits } = require("viem");
const { privateKeyToAccount } = require("viem/accounts");
const { StoryIliad } = require("../const/customChains");
const { StoryIliad, StoryOdyssey } = require("../const/customChains");
const {
base,
kroma,
Expand Down Expand Up @@ -76,18 +76,18 @@ async function main() {
const account = privateKeyToAccount(process.env.ADMIN_PRIVATE_KEY);
const walletClient = createWalletClient({
account,
chain: morphHolesky,
transport: http(process.env.MORPH_HOLESKY_RPC),
chain: StoryOdyssey,
transport: http(process.env.STORY_ODYSSEY_RPC),
});

const abi = MatchingEngineABI;

const pairs = await getPairs("Morph Holesky");
const pairs = await getPairs("Story Odyssey Testnet");

console.log("Pairs to add:", pairs.length);
// make contract call on each pair in the list
const matchingEngine =
defaultTokenList.matchingEngine["Morph Holesky"].address;
defaultTokenList.matchingEngine["Story Odyssey Testnet"].address;

for (const pair of pairs) {
await addPair(pair, matchingEngine, walletClient, abi);
Expand Down
2 changes: 1 addition & 1 deletion src/scripts/generateDefaultPairs.js
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
// replace path with path to desired network tokenlist
const tokenlist = require("../tokens/story_iliad.json");
const tokenlist = require("../tokens/story_odyssey.json");

function sleep(ms) {
return new Promise((resolve) => setTimeout(resolve, ms));
Expand Down
Loading

0 comments on commit a583939

Please sign in to comment.