Skip to content

Commit

Permalink
feat: support relaying lens testnet (#1995)
Browse files Browse the repository at this point in the history
* feat: support relaying lens testnet

Signed-off-by: bennett <[email protected]>

---------

Signed-off-by: bennett <[email protected]>
  • Loading branch information
bmzig authored Jan 10, 2025
1 parent 6946b58 commit b7db630
Show file tree
Hide file tree
Showing 5 changed files with 48 additions and 24 deletions.
6 changes: 3 additions & 3 deletions package.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,9 +10,9 @@
"node": ">=20"
},
"dependencies": {
"@across-protocol/constants": "^3.1.25",
"@across-protocol/contracts": "^3.0.19",
"@across-protocol/sdk": "^3.4.7",
"@across-protocol/constants": "^3.1.27",
"@across-protocol/contracts": "^3.0.20",
"@across-protocol/sdk": "^3.4.9",
"@arbitrum/sdk": "^4.0.2",
"@consensys/linea-sdk": "^0.2.1",
"@defi-wonderland/smock": "^2.3.5",
Expand Down
8 changes: 7 additions & 1 deletion src/clients/ProfitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -567,7 +567,12 @@ export class ProfitClient {
// Also ensure all gas tokens are included in the lookup.
this.enabledChainIds.forEach((chainId) => {
const symbol = getNativeTokenSymbol(chainId);
tokens[symbol] ??= TOKEN_SYMBOLS_MAP[symbol].addresses[CHAIN_IDs.MAINNET];
let nativeTokenAddress = TOKEN_SYMBOLS_MAP[symbol].addresses[CHAIN_IDs.MAINNET];
// For testnet only, if the custom gas token has no mainnet address, use ETH.
if (this.hubPoolClient.chainId === CHAIN_IDs.SEPOLIA && !isDefined(nativeTokenAddress)) {
nativeTokenAddress = TOKEN_SYMBOLS_MAP["ETH"].addresses[CHAIN_IDs.MAINNET];
}
tokens[symbol] ??= nativeTokenAddress;
});

this.logger.debug({ at: "ProfitClient", message: "Updating Profit client", tokens });
Expand Down Expand Up @@ -610,6 +615,7 @@ export class ProfitClient {
[CHAIN_IDs.REDSTONE]: "WETH", // Redstone only supports WETH.
[CHAIN_IDs.WORLD_CHAIN]: "WETH", // USDC deferred on World Chain.
[CHAIN_IDs.INK]: "WETH", // USDC deferred on Ink.
[CHAIN_IDs.LENS_SEPOLIA]: "WETH", // No USD token on Lens Sepolia
};
const prodRelayer = process.env.RELAYER_FILL_SIMULATION_ADDRESS ?? PROD_RELAYER;
const [defaultTestSymbol, relayer] =
Expand Down
5 changes: 5 additions & 0 deletions src/common/Constants.ts
Original file line number Diff line number Diff line change
Expand Up @@ -121,6 +121,7 @@ export const CHAIN_MAX_BLOCK_LOOKBACK = {
[CHAIN_IDs.BASE_SEPOLIA]: 10000,
[CHAIN_IDs.BLAST_SEPOLIA]: 10000,
[CHAIN_IDs.INK_SEPOLIA]: 10000,
[CHAIN_IDs.LENS_SEPOLIA]: 10000,
[CHAIN_IDs.LISK_SEPOLIA]: 10000,
[CHAIN_IDs.MODE_SEPOLIA]: 10000,
[CHAIN_IDs.OPTIMISM_SEPOLIA]: 10000,
Expand Down Expand Up @@ -155,6 +156,7 @@ export const BUNDLE_END_BLOCK_BUFFERS = {
[CHAIN_IDs.BASE_SEPOLIA]: 0,
[CHAIN_IDs.BLAST_SEPOLIA]: 0,
[CHAIN_IDs.INK_SEPOLIA]: 0,
[CHAIN_IDs.LENS_SEPOLIA]: 0,
[CHAIN_IDs.LISK_SEPOLIA]: 0,
[CHAIN_IDs.MODE_SEPOLIA]: 0,
[CHAIN_IDs.OPTIMISM_SEPOLIA]: 0,
Expand Down Expand Up @@ -204,6 +206,7 @@ export const CHAIN_CACHE_FOLLOW_DISTANCE: { [chainId: number]: number } = {
[CHAIN_IDs.BLAST_SEPOLIA]: 0,
[CHAIN_IDs.INK_SEPOLIA]: 0,
[CHAIN_IDs.LISK_SEPOLIA]: 0,
[CHAIN_IDs.LENS_SEPOLIA]: 0,
[CHAIN_IDs.MODE_SEPOLIA]: 0,
[CHAIN_IDs.OPTIMISM_SEPOLIA]: 0,
[CHAIN_IDs.POLYGON_AMOY]: 0,
Expand Down Expand Up @@ -314,6 +317,7 @@ export const SUPPORTED_TOKENS: { [chainId: number]: string[] } = {
[CHAIN_IDs.ARBITRUM_SEPOLIA]: ["USDC", "USDT", "WETH", "DAI", "WBTC", "UMA", "ACX"],
[CHAIN_IDs.BASE_SEPOLIA]: ["BAL", "DAI", "ETH", "WETH", "USDC"],
[CHAIN_IDs.BLAST_SEPOLIA]: ["WETH"],
[CHAIN_IDs.LENS_SEPOLIA]: ["WETH"],
[CHAIN_IDs.LISK_SEPOLIA]: ["WETH", "USDT"],
[CHAIN_IDs.MODE_SEPOLIA]: ["ETH", "WETH", "USDC", "USDT", "WBTC"],
[CHAIN_IDs.OPTIMISM_SEPOLIA]: ["DAI", "SNX", "BAL", "ETH", "WETH", "USDC", "USDT", "WBTC", "UMA", "ACX"],
Expand Down Expand Up @@ -357,6 +361,7 @@ export const CANONICAL_BRIDGE: {
[CHAIN_IDs.BLAST]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.BLAST_SEPOLIA]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.INK]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.LENS_SEPOLIA]: ZKSyncBridge, // TODO
[CHAIN_IDs.LINEA]: LineaBridge,
[CHAIN_IDs.LISK]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.LISK_SEPOLIA]: OpStackDefaultERC20Bridge,
Expand Down
18 changes: 18 additions & 0 deletions src/common/ContractAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -437,6 +437,17 @@ export const CONTRACT_ADDRESSES: {
orbitErc20Gateway_421614: {
abi: ARBITRUM_ERC20_GATEWAY_L1_ABI,
},
zkSyncDefaultErc20Bridge: {
address: "0x7303b5ce64f1adb0558572611a0b90620b6dd5f4",
abi: ZK_SYNC_DEFAULT_ERC20_BRIDGE_L1_ABI,
},
zkSyncMailbox: {
address: "", // TODO
abi: ZK_SYNC_MAILBOX_ABI,
},
hubPool: {
address: "0x14224e63716afAcE30C9a417E0542281869f7d9e",
},
},
[CHAIN_IDs.ARBITRUM_SEPOLIA]: {
erc20Gateway: {
Expand All @@ -463,6 +474,13 @@ export const CONTRACT_ADDRESSES: {
abi: OVM_L2_STANDARD_BRIDGE_ABI,
},
},
[CHAIN_IDs.LENS_SEPOLIA]: {
// TODO: Rename to zkstack once zkstack adapters are made.
zkSyncDefaultErc20Bridge: {
address: "0x427373Be173120D7A042b44D0804E37F25E7330b",
abi: ZK_SYNC_DEFAULT_ERC20_BRIDGE_L2_ABI,
},
},
[CHAIN_IDs.LISK_SEPOLIA]: {
ovmStandardBridge: {
address: "0x4200000000000000000000000000000000000010",
Expand Down
35 changes: 15 additions & 20 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,15 +11,10 @@
"@uma/common" "^2.17.0"
hardhat "^2.9.3"

"@across-protocol/constants@^3.1.24":
version "3.1.24"
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.24.tgz#01fe49330bb467dd01813387ddbac741bc74a035"
integrity sha512-guKtvIbif//vsmSZbwGubTWVtfkWiyWenr2sVyo63U/68GOW89ceJRLu4efLjeLVGiSrNAJtFUCv9dTwrrosWA==

"@across-protocol/constants@^3.1.25":
version "3.1.25"
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.25.tgz#60d6d9814582ff91faf2b6d9f51d6dccb447b4ce"
integrity sha512-GpZoYn7hETYL2BPMM2GqXAer6+l/xuhder+pvpb00HJcb/sqCjF7vaaeKxjKJ3jKtyeulYmdu0NDkeNm5KbNWA==
"@across-protocol/constants@^3.1.27":
version "3.1.27"
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.27.tgz#6c7b2b277d83ae1024c1de6faf474192391af0bd"
integrity sha512-3YEK2ERB2FVdDdrkFk5YeuRu/oIAHTIeu6YfT39SfZjIPyltP0ReFlDfZQ8c+rFiHurwyK39kjZF70VxRRREYw==

"@across-protocol/contracts@^0.1.4":
version "0.1.4"
Expand All @@ -30,12 +25,12 @@
"@openzeppelin/contracts" "4.1.0"
"@uma/core" "^2.18.0"

"@across-protocol/contracts@^3.0.19":
version "3.0.19"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-3.0.19.tgz#3756504bb3f5f625f9ca403045a79050e675602f"
integrity sha512-9GjKKF8SHGKP9FGhawHzLZ8sfBVFUICd+Bn1pn3SFuh0p+ndQIayG+QEYRKGFUXVPV6+XXLve750PQ1Hu7dIEg==
"@across-protocol/contracts@^3.0.20":
version "3.0.20"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-3.0.20.tgz#5a70782093d21a96b2e955b7ed725bea7af6e804"
integrity sha512-ufyO+MrbY7+0TDm/1cDl9iAeR4P8jt0AM1F9wiCBHVIYtj1wMD4eNm7G5Am3u8p1ruMjRhi6dJEVQcRF2O+LUg==
dependencies:
"@across-protocol/constants" "^3.1.24"
"@across-protocol/constants" "^3.1.27"
"@coral-xyz/anchor" "^0.30.1"
"@defi-wonderland/smock" "^2.3.4"
"@eth-optimism/contracts" "^0.5.40"
Expand All @@ -58,14 +53,14 @@
yargs "^17.7.2"
zksync-web3 "^0.14.3"

"@across-protocol/sdk@^3.4.7":
version "3.4.7"
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.4.7.tgz#6ddf9698f918d7b7e0216327d60b54b37fe14f22"
integrity sha512-GeyzDG8EzlN8oddmjXASqND+usZPkWDLpzbdWfAfBfHT3pjIMatntZqZghfCfjy+ICf+rlYrAb8I24H4jlct8Q==
"@across-protocol/sdk@^3.4.9":
version "3.4.9"
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.4.9.tgz#9e23a9d678e09c97f5b3c60b811ef7d5291d82a4"
integrity sha512-o6WRvjwPgdicpCL8v32Ldp6sPBVC2EObhLn8fSTPn7F/3N7bI0A/8IEAHw3HzSCvMSgRXXcBNObJyZRE5PBMVQ==
dependencies:
"@across-protocol/across-token" "^1.0.0"
"@across-protocol/constants" "^3.1.25"
"@across-protocol/contracts" "^3.0.19"
"@across-protocol/constants" "^3.1.27"
"@across-protocol/contracts" "^3.0.20"
"@eth-optimism/sdk" "^3.3.1"
"@ethersproject/bignumber" "^5.7.0"
"@pinata/sdk" "^2.1.0"
Expand Down

0 comments on commit b7db630

Please sign in to comment.