Skip to content

Commit

Permalink
feat: support mode-sepolia (#646)
Browse files Browse the repository at this point in the history
  • Loading branch information
dohaki authored May 16, 2024
1 parent 3f95ec8 commit f0d5511
Show file tree
Hide file tree
Showing 6 changed files with 71 additions and 17 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "@across-protocol/sdk-v2",
"author": "UMA Team",
"version": "0.23.11",
"version": "0.23.12",
"license": "AGPL-3.0",
"homepage": "https://docs.across.to/reference/sdk",
"files": [
Expand Down Expand Up @@ -99,8 +99,8 @@
},
"dependencies": {
"@across-protocol/across-token": "^1.0.0",
"@across-protocol/constants-v2": "^1.0.20",
"@across-protocol/contracts-v2": "2.5.6",
"@across-protocol/constants-v2": "^1.0.26",
"@across-protocol/contracts-v2": "2.5.7",
"@eth-optimism/sdk": "^3.2.2",
"@pinata/sdk": "^2.1.0",
"@types/mocha": "^10.0.1",
Expand Down
1 change: 1 addition & 0 deletions src/relayFeeCalculator/chain-queries/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -7,3 +7,4 @@ export * from "./linea";
export * from "./optimism";
export * from "./polygon";
export * from "./zksync";
export * from "./mode";
55 changes: 55 additions & 0 deletions src/relayFeeCalculator/chain-queries/mode.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,55 @@
import { DEFAULT_LOGGER, Logger } from "../relayFeeCalculator";
import { providers } from "ethers";
import {
DEFAULT_ARWEAVE_STORAGE_ADDRESS,
DEFAULT_SIMULATED_RELAYER_ADDRESS_TEST,
TOKEN_SYMBOLS_MAP,
CHAIN_IDs,
} from "../../constants";
import { asL2Provider } from "@eth-optimism/sdk/dist/l2-provider";
import QueryBase from "./baseQuery";
import { getDeployedAddress } from "../../utils/DeploymentUtils";

export class ModeQueries extends QueryBase {
constructor(
provider: providers.Provider,
symbolMapping = TOKEN_SYMBOLS_MAP,
spokePoolAddress = getDeployedAddress("SpokePool", CHAIN_IDs.MODE),
simulatedRelayerAddress = DEFAULT_ARWEAVE_STORAGE_ADDRESS,
coingeckoProApiKey?: string,
logger: Logger = DEFAULT_LOGGER,
gasMarkup = 0
) {
super(
asL2Provider(provider),
symbolMapping,
spokePoolAddress,
simulatedRelayerAddress,
gasMarkup,
logger,
coingeckoProApiKey
);
}
}

export class ModeSepoliaQueries extends QueryBase {
constructor(
provider: providers.Provider,
symbolMapping = TOKEN_SYMBOLS_MAP,
spokePoolAddress = getDeployedAddress("SpokePool", CHAIN_IDs.MODE_SEPOLIA),
simulatedRelayerAddress = DEFAULT_SIMULATED_RELAYER_ADDRESS_TEST,
coingeckoProApiKey?: string,
logger: Logger = DEFAULT_LOGGER,
gasMarkup = 0
) {
super(
asL2Provider(provider),
symbolMapping,
spokePoolAddress,
simulatedRelayerAddress,
gasMarkup,
logger,
coingeckoProApiKey
);
}
}
1 change: 1 addition & 0 deletions src/utils/BlockUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -37,6 +37,7 @@ const blockTimes: { [chainId: number]: BlockTimeAverage } = {
1: { average: 12.5, timestamp: now, blockRange: 1 },
10: { average: 2, timestamp: now, blockRange: 1 },
8453: { average: 2, timestamp: now, blockRange: 1 },
34443: { average: 2, timestamp: now, blockRange: 1 },
59144: { average: 3, timestamp: now, blockRange: 1 },
};

Expand Down
2 changes: 2 additions & 0 deletions src/utils/NetworkUtils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -51,10 +51,12 @@ export function chainIsOPStack(chainId: number): boolean {
return [
CHAIN_IDs.OPTIMISM,
CHAIN_IDs.BASE,
CHAIN_IDs.MODE,
CHAIN_IDs.OPTIMISM_GOERLI,
CHAIN_IDs.BASE_GOERLI,
CHAIN_IDs.OPTIMISM_SEPOLIA,
CHAIN_IDs.BASE_SEPOLIA,
CHAIN_IDs.MODE_SEPOLIA,
].includes(chainId);
}

Expand Down
23 changes: 9 additions & 14 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -16,22 +16,17 @@
"@uma/common" "^2.17.0"
hardhat "^2.9.3"

"@across-protocol/constants-v2@^1.0.19":
version "1.0.19"
resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.19.tgz#398d64f590bb0ebea6c4241acac2af24af4ab4e1"
integrity sha512-v12qvWxuN37HLSCg+LahzGIShakR4/+l7K6GtVEIRg/dj/HTUtGzgpB4Uyx6nYkA6ffAKcxJaUK600JovNhkEA==

"@across-protocol/constants-v2@^1.0.20":
version "1.0.20"
resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.20.tgz#d28fb3d3be8514db51c214d92bee954d15e5f06a"
integrity sha512-DYb48kaAzv7t4/FVi4a5KYGNxJSG2rOY2mSznuWDI4n4mezM1wTTtQzK3un15tcwkTlIeO13CaDeABgR6jIVvg==
"@across-protocol/constants-v2@^1.0.26":
version "1.0.26"
resolved "https://registry.yarnpkg.com/@across-protocol/constants-v2/-/constants-v2-1.0.26.tgz#04fff84574af9fe4128318a19d7b7990ee10f32e"
integrity sha512-XuxBGNvhevdTT+GQGreg1YP+RsRWzuqOEHNA9m/p7l3qjFkXuWUM9nj77ttccbIi0tCZQDiMR8VxwHBCAXB4LQ==

"@across-protocol/[email protected].6":
version "2.5.6"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts-v2/-/contracts-v2-2.5.6.tgz#3734e03ca42b81e8a878e6d88a5c5ddcb5a8e9ca"
integrity sha512-A3bmYubISoH/KpaOKYNJ4/SF2f/VLdfo94+/9P1zNDL9bq/S/1KeKq8SU7jjPIJ9JEAqIUk5HhNgrQjYx/1ZkQ==
"@across-protocol/[email protected].7":
version "2.5.7"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts-v2/-/contracts-v2-2.5.7.tgz#5bafbda17a4196593130c175fa6dc5d3b9d9f88d"
integrity sha512-MsvwUfjLiNmGHdVvTQxPHaOIt5U3bWRC99aM2cTzTw629ktH13G5PsCUgAPmPyXqm3WtyQqIOOcEuw5Sz0BAtA==
dependencies:
"@across-protocol/constants-v2" "^1.0.19"
"@across-protocol/constants-v2" "^1.0.26"
"@defi-wonderland/smock" "^2.3.4"
"@eth-optimism/contracts" "^0.5.40"
"@ethersproject/abstract-provider" "5.7.0"
Expand Down

0 comments on commit f0d5511

Please sign in to comment.