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 Lens Sepolia #1368

Merged
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
27 commits
Select commit Hold shift + click to select a range
f547650
update deps
gsteenkamp89 Jan 10, 2025
194a070
add chain config
gsteenkamp89 Jan 10, 2025
70bcac4
update sdk
gsteenkamp89 Jan 10, 2025
7cadc8a
generate routes and ui assets
gsteenkamp89 Jan 10, 2025
3c0a5ed
Merge branch 'master' into gerhard/acx-3081-update-frontend-dapp-lens…
gsteenkamp89 Jan 10, 2025
f693a2a
fixes
gsteenkamp89 Jan 10, 2025
8077f3f
Undo zora logo changes
gsteenkamp89 Jan 10, 2025
d4fe97f
add path to animate id
gsteenkamp89 Jan 10, 2025
03316e6
fix routes
gsteenkamp89 Jan 10, 2025
d2d9870
add wgrass to sepolia and generate routes
gsteenkamp89 Jan 10, 2025
b60c1a2
fix: add missing grass logo
dohaki Jan 11, 2025
b5b34a8
fix: use custom gas token in limits
dohaki Jan 13, 2025
9592e32
fixup
dohaki Jan 13, 2025
22de5c2
fix: GRASS capital cost config
dohaki Jan 13, 2025
a8ba1cf
fix: GRASS on sepolia
dohaki Jan 13, 2025
85255e3
fix: GRASS/WGRASS behavior in selector
dohaki Jan 13, 2025
88cf5ae
improve: debug logs
dohaki Jan 13, 2025
c4b6de3
fix: log level
dohaki Jan 13, 2025
0492cd9
fixup
dohaki Jan 13, 2025
5e226fc
fix wgrass routes
gsteenkamp89 Jan 13, 2025
14ed903
Merge branch 'gerhard/acx-3081-update-frontend-dapp-lens-testnet' of …
gsteenkamp89 Jan 13, 2025
35530ba
Revert "fix wgrass routes"
gsteenkamp89 Jan 13, 2025
bb1f0fe
fix wgrass route
gsteenkamp89 Jan 13, 2025
8222a7c
Merge branch 'master' into gerhard/acx-3081-update-frontend-dapp-lens…
gsteenkamp89 Jan 14, 2025
b823784
update lockfile
gsteenkamp89 Jan 14, 2025
a7d51d7
Merge branch 'master' into gerhard/acx-3081-update-frontend-dapp-lens…
gsteenkamp89 Jan 15, 2025
dfe69cd
fix lint warnings
gsteenkamp89 Jan 15, 2025
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
6 changes: 6 additions & 0 deletions api/_constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -98,6 +98,12 @@ const defaultRelayerFeeCapitalCostConfig: {
cutoff: ethers.utils.parseUnits("10000").toString(),
decimals: 18,
},
GRASS: {
lowerBound: ethers.utils.parseUnits("0.0001").toString(),
upperBound: ethers.utils.parseUnits("0.0005").toString(),
cutoff: ethers.utils.parseUnits("10000").toString(),
decimals: 18,
},
};

defaultRelayerFeeCapitalCostConfig["USDC.e"] = {
Expand Down
1 change: 1 addition & 0 deletions api/_errors.ts
Original file line number Diff line number Diff line change
Expand Up @@ -267,6 +267,7 @@ export function handleErrorCondition(
at: endpoint,
code: acrossApiError.code,
message: `Status ${acrossApiError.status} - ${acrossApiError.message}`,
cause: acrossApiError.cause,
});

return response.status(acrossApiError.status).json(acrossApiError);
Expand Down
29 changes: 8 additions & 21 deletions api/_utils.ts
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,6 @@ type RpcProviderName = keyof typeof rpcProvidersJson.providers.urls;

const {
REACT_APP_HUBPOOL_CHAINID,
REACT_APP_PUBLIC_INFURA_ID,
REACT_APP_COINGECKO_PRO_API_KEY,
BASE_FEE_MARKUP,
PRIORITY_FEE_MARKUP,
Expand Down Expand Up @@ -165,9 +164,9 @@ export const getLogger = (): LoggingUtility => {
const defaultLogLevel = VERCEL_ENV === "production" ? "ERROR" : "DEBUG";

let logLevel =
LOG_LEVEL && !Object.keys(LogLevels).includes(LOG_LEVEL)
? defaultLogLevel
: (LOG_LEVEL as keyof typeof LogLevels);
LOG_LEVEL && Object.keys(LogLevels).includes(LOG_LEVEL)
? (LOG_LEVEL as keyof typeof LogLevels)
: defaultLogLevel;

logger = {
debug: (...args) => {
Expand Down Expand Up @@ -537,19 +536,6 @@ export const getHubPool = (provider: providers.Provider) => {
return HubPool__factory.connect(ENABLED_ROUTES.hubPoolAddress, provider);
};

/**
* Resolves an Infura provider given the name of the ETH network
* @param nameOrChainId The name of an ethereum network
* @returns A valid Ethers RPC provider
*/
export const infuraProvider = (nameOrChainId: providers.Networkish) => {
const url = new ethers.providers.InfuraProvider(
nameOrChainId,
REACT_APP_PUBLIC_INFURA_ID
).connection.url;
return new ethers.providers.StaticJsonRpcProvider(url);
};

/**
* Resolves a fixed Static RPC provider if an override url has been specified.
* @returns A provider or undefined if an override was not specified.
Expand Down Expand Up @@ -906,7 +892,7 @@ export const getProvider = (
} else if (override) {
providerCache[cacheKey] = override;
} else {
providerCache[cacheKey] = infuraProvider(_chainId);
throw new Error(`No provider URL set for chain: ${chainId}`);
}
}
return providerCache[cacheKey];
Expand All @@ -925,9 +911,10 @@ function getProviderFromConfigJson(
const urls = getRpcUrlsFromConfigJson(chainId);

if (urls.length === 0) {
console.warn(
`No provider URL found for chainId ${chainId} in rpc-providers.json`
);
getLogger().warn({
at: "getProviderFromConfigJson",
message: `No provider URL found for chainId ${chainId} in rpc-providers.json`,
});
return undefined;
}

Expand Down
3 changes: 2 additions & 1 deletion api/limits.ts
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,8 @@ const handler = async (
] = await Promise.all([
getCachedTokenPrice(
l1Token.address,
sdk.utils.getNativeTokenSymbol(destinationChainId).toLowerCase()
sdk.constants.CUSTOM_GAS_TOKENS[destinationChainId]?.toLowerCase() ??
sdk.utils.getNativeTokenSymbol(destinationChainId).toLowerCase()
),
getCachedTokenPrice(l1Token.address, "usd"),
getCachedLatestBlock(HUB_POOL_CHAIN_ID),
Expand Down
1 change: 1 addition & 0 deletions scripts/chain-configs/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@ export { default as BASE_SEPOLIA } from "./base-sepolia";
export { default as BLAST } from "./blast";
export { default as BLAST_SEPOLIA } from "./blast-sepolia";
export { default as INK } from "./ink";
export { default as LENS_SEPOLIA } from "./lens-sepolia";
export { default as LINEA } from "./linea";
export { default as LISK } from "./lisk";
export { default as LISK_SEPOLIA } from "./lisk-sepolia";
Expand Down
13 changes: 13 additions & 0 deletions scripts/chain-configs/lens-sepolia/assets/grayscale-logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions scripts/chain-configs/lens-sepolia/assets/logo.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions scripts/chain-configs/lens-sepolia/index.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
import { CHAIN_IDs, PUBLIC_NETWORKS } from "@across-protocol/constants";
import { utils as sdkUtils } from "@across-protocol/sdk";
import { ChainConfig } from "../types";

const { getDeployedAddress, getDeployedBlockNumber } = sdkUtils;

const chainId = CHAIN_IDs.LENS_SEPOLIA;
const chainInfoBase = PUBLIC_NETWORKS[chainId];

export default {
...chainInfoBase,
logoPath: "./assets/logo.svg",
grayscaleLogoPath: "./assets/grayscale-logo.svg",
spokePool: {
address: getDeployedAddress("SpokePool", chainId),
blockNumber: getDeployedBlockNumber("SpokePool", chainId),
},
chainId,
publicRpcUrl: "https://rpc.testnet.lens.dev",
blockTimeSeconds: 1,
tokens: ["GRASS", "WETH", "WGRASS"],
enableCCTP: false,
} as ChainConfig;
2 changes: 1 addition & 1 deletion scripts/chain-configs/sepolia/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ export default {
},
chainId,
publicRpcUrl: "https://gateway.tenderly.co/public/sepolia",
tokens: ["WETH", "ETH", "USDC"],
tokens: ["WETH", "ETH", "USDC", "GRASS"],
enableCCTP: false,
swapTokens: [],
} as ChainConfig;
13 changes: 13 additions & 0 deletions scripts/generate-routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -58,6 +58,7 @@ const enabledSepoliaChainConfigs = [
chainConfigs.POLYGON_AMOY,
chainConfigs.BLAST_SEPOLIA,
chainConfigs.LISK_SEPOLIA,
chainConfigs.LENS_SEPOLIA,
];

const enabledRoutes = {
Expand Down Expand Up @@ -275,6 +276,18 @@ function transformChainConfigs(
];
}

if (
tokenSymbol === "WGRASS" &&
toChainConfig.tokens.includes("GRASS")
) {
return [
{
inputTokenSymbol: "WGRASS",
outputTokenSymbol: "GRASS",
},
];
}

// Handle WETH Polygon & other non-eth chains
if (
tokenSymbol === "WETH" &&
Expand Down
14 changes: 14 additions & 0 deletions src/assets/chain-logos/lens-sepolia-grayscale.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
13 changes: 13 additions & 0 deletions src/assets/chain-logos/lens-sepolia.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
23 changes: 23 additions & 0 deletions src/constants/chains/configs.ts
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,11 @@ import inkGrayscaleLogo from "assets/chain-logos/ink-grayscale.svg";
import { ReactComponent as inkLogoSvg } from "assets/chain-logos/ink.svg";
import { ReactComponent as inkGrayscaleLogoSvg } from "assets/chain-logos/ink-grayscale.svg";

import lensSepoliaLogo from "assets/chain-logos/lens-sepolia.svg";
import lensSepoliaGrayscaleLogo from "assets/chain-logos/lens-sepolia-grayscale.svg";
import { ReactComponent as lensSepoliaLogoSvg } from "assets/chain-logos/lens-sepolia.svg";
import { ReactComponent as lensSepoliaGrayscaleLogoSvg } from "assets/chain-logos/lens-sepolia-grayscale.svg";

import lineaLogo from "assets/chain-logos/linea.svg";
import lineaGrayscaleLogo from "assets/chain-logos/linea-grayscale.svg";
import { ReactComponent as lineaLogoSvg } from "assets/chain-logos/linea.svg";
Expand Down Expand Up @@ -259,6 +264,23 @@ export const ink = {
pollingInterval: 1000,
};

export const lensSepolia = {
name: "Lens Sepolia",
fullName: "Lens sepolia",
chainId: 37111,
logoURI: lensSepoliaLogo,
grayscaleLogoURI: lensSepoliaGrayscaleLogo,
logoSvg: lensSepoliaLogoSvg,
grayscaleLogoSvg: lensSepoliaGrayscaleLogoSvg,
rpcUrl: "https://rpc.testnet.lens.dev",
explorerUrl: "https://block-explorer.testnet.lens.dev",
constructExplorerLink: (txHash: string) =>
`${lensSepolia.explorerUrl}/tx/${txHash}`,
nativeCurrencySymbol: "GRASS",
customRpcUrl: process.env.REACT_APP_CHAIN_37111_PROVIDER_URL,
pollingInterval: 1000,
};

export const linea = {
name: "Linea",
fullName: "Linea",
Expand Down Expand Up @@ -554,6 +576,7 @@ export const chainConfigs = [
blast,
blastSepolia,
ink,
lensSepolia,
linea,
lisk,
liskSepolia,
Expand Down
1 change: 1 addition & 0 deletions src/constants/chains/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@ const orderedEnabledChainIds = [
CHAIN_IDs.POLYGON_AMOY,
CHAIN_IDs.BLAST_SEPOLIA,
CHAIN_IDs.LISK_SEPOLIA,
CHAIN_IDs.LENS_SEPOLIA,
];

export const chainInfoList: ChainInfoList = orderedEnabledChainIds.map(
Expand Down
4 changes: 4 additions & 0 deletions src/constants/tokens.ts
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,8 @@ import snxLogo from "assets/token-logos/snx.svg";
import pooltogetherLogo from "assets/token-logos/pool.svg";
import lskLogo from "assets/token-logos/lsk.svg";
import usdbLogo from "assets/token-logos/usdb.svg";
// TODO: Replace with actual GRASS logo once known
import grassLogo from "assets/icons/question-circle.svg";

import { BRIDGED_USDC_SYMBOLS } from "../utils/sdk";

Expand Down Expand Up @@ -83,4 +85,6 @@ export const orderedTokenLogos = {
OP: optimismLogo,
ARB: arbitrumLogo,
LSK: lskLogo,
GRASS: grassLogo,
WGRASS: grassLogo,
};
69 changes: 69 additions & 0 deletions src/data/chains_11155111.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,6 +28,13 @@
"name": "USD Coin",
"decimals": 6,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/usdc.svg"
},
{
"address": "0x2Be68B15c693D3b5747F9F0D49D30A2E81BAA2Df",
"symbol": "GRASS",
"name": "Grass",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/grass.svg"
}
],
"outputTokens": [
Expand All @@ -51,6 +58,13 @@
"name": "USD Coin",
"decimals": 6,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/usdc.svg"
},
{
"address": "0x2Be68B15c693D3b5747F9F0D49D30A2E81BAA2Df",
"symbol": "GRASS",
"name": "Grass",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/grass.svg"
}
]
},
Expand Down Expand Up @@ -382,5 +396,60 @@
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/eth.svg"
}
]
},
{
"chainId": 37111,
"name": "Lens Sepolia",
"publicRpcUrl": "https://rpc.testnet.lens.dev",
"explorerUrl": "https://block-explorer.testnet.lens.dev",
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/scripts/chain-configs/lens-sepolia/assets/logo.svg",
"spokePool": "0x6A0a7f39530923911832Dd60667CE5da5449967B",
"spokePoolBlock": 156275,
"inputTokens": [
{
"address": "0xeee5a340Cdc9c179Db25dea45AcfD5FE8d4d3eB8",
"symbol": "GRASS",
"name": "Grass",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/grass.svg"
},
{
"address": "0xaA91D645D7a6C1aeaa5988e0547267B77d33fe16",
"symbol": "WETH",
"name": "Wrapped Ether",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/weth.svg"
},
{
"address": "0xeee5a340Cdc9c179Db25dea45AcfD5FE8d4d3eB8",
"symbol": "WGRASS",
"name": "Wrapped Grass",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/wgrass.svg"
}
],
"outputTokens": [
{
"address": "0xaA91D645D7a6C1aeaa5988e0547267B77d33fe16",
"symbol": "WETH",
"name": "Wrapped Ether",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/weth.svg"
},
{
"address": "0xaA91D645D7a6C1aeaa5988e0547267B77d33fe16",
"symbol": "ETH",
"name": "Ether",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/eth.svg"
},
{
"address": "0xeee5a340Cdc9c179Db25dea45AcfD5FE8d4d3eB8",
"symbol": "GRASS",
"name": "Grass",
"decimals": 18,
"logoUrl": "https://raw.githubusercontent.com/across-protocol/frontend/master/src/assets/token-logos/grass.svg"
}
]
}
]
Loading
Loading