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: enable Ink in the relayer #1966

Merged
merged 5 commits into from
Dec 30, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
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: 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.22",
"@across-protocol/contracts": "^3.0.18",
"@across-protocol/sdk": "^3.3.26",
"@across-protocol/constants": "^3.1.24",
"@across-protocol/contracts": "^3.0.19",
"@across-protocol/sdk": "^3.3.27",
"@arbitrum/sdk": "^4.0.2",
"@consensys/linea-sdk": "^0.2.1",
"@defi-wonderland/smock": "^2.3.5",
Expand Down
1 change: 1 addition & 0 deletions src/clients/ProfitClient.ts
Original file line number Diff line number Diff line change
Expand Up @@ -608,6 +608,7 @@ export class ProfitClient {
[CHAIN_IDs.LISK]: "USDT", // USDC is not yet supported on Lisk, so revert to USDT. @todo: Update.
[CHAIN_IDs.REDSTONE]: "WETH", // Redstone only supports WETH.
[CHAIN_IDs.WORLD_CHAIN]: "WETH", // USDC deferred on World Chain.
james-a-morris marked this conversation as resolved.
Show resolved Hide resolved
[CHAIN_IDs.INK]: "WETH", // USDC deferred on Ink.
};
const prodRelayer = process.env.RELAYER_FILL_SIMULATION_ADDRESS ?? PROD_RELAYER;
const [defaultTestSymbol, relayer] =
Expand Down
31 changes: 29 additions & 2 deletions src/clients/bridges/AdapterManager.ts
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,22 @@ export class AdapterManager {
);
};

const { OPTIMISM, ARBITRUM, POLYGON, ZK_SYNC, BASE, MODE, LINEA, LISK, BLAST, REDSTONE, SCROLL, ZORA, ALEPH_ZERO } =
CHAIN_IDs;
const {
OPTIMISM,
ARBITRUM,
POLYGON,
ZK_SYNC,
BASE,
MODE,
LINEA,
LISK,
BLAST,
REDSTONE,
SCROLL,
ZORA,
ALEPH_ZERO,
INK,
} = CHAIN_IDs;
const hubChainId = hubPoolClient.chainId;
const l1Signer = spokePoolClients[hubChainId].spokePool.signer;
const constructBridges = (chainId: number) => {
Expand Down Expand Up @@ -185,6 +199,19 @@ export class AdapterManager {
);
}

if (this.spokePoolClients[INK] !== undefined) {
james-a-morris marked this conversation as resolved.
Show resolved Hide resolved
this.adapters[INK] = new BaseChainAdapter(
spokePoolClients,
INK,
hubChainId,
filterMonitoredAddresses(INK),
logger,
SUPPORTED_TOKENS[INK],
constructBridges(INK),
DEFAULT_GAS_MULTIPLIER[INK] ?? 1
);
}

logger.debug({
at: "AdapterManager#constructor",
message: "Initialized AdapterManager",
Expand Down
34 changes: 34 additions & 0 deletions src/common/Constants.ts
james-a-morris marked this conversation as resolved.
Show resolved Hide resolved
Original file line number Diff line number Diff line change
Expand Up @@ -64,6 +64,7 @@ export const MIN_DEPOSIT_CONFIRMATIONS: { [threshold: number | string]: { [chain
[CHAIN_IDs.ARBITRUM]: 0,
[CHAIN_IDs.BASE]: 120,
[CHAIN_IDs.BLAST]: 120,
[CHAIN_IDs.INK]: 120, // Follows Optimism
[CHAIN_IDs.LINEA]: 30,
[CHAIN_IDs.LISK]: 120,
[CHAIN_IDs.MAINNET]: 64, // Finalized block: https://www.alchemy.com/overviews/ethereum-commitment-levels
Expand All @@ -81,6 +82,7 @@ export const MIN_DEPOSIT_CONFIRMATIONS: { [threshold: number | string]: { [chain
[CHAIN_IDs.ARBITRUM]: 0,
[CHAIN_IDs.BASE]: 60,
[CHAIN_IDs.BLAST]: 60,
[CHAIN_IDs.INK]: 60, // Follows Optimism
[CHAIN_IDs.LINEA]: 1,
[CHAIN_IDs.LISK]: 60,
[CHAIN_IDs.MAINNET]: 32, // Justified block
Expand All @@ -98,6 +100,7 @@ export const MIN_DEPOSIT_CONFIRMATIONS: { [threshold: number | string]: { [chain
[CHAIN_IDs.ARBITRUM]: 0,
[CHAIN_IDs.BASE]: 60,
[CHAIN_IDs.BLAST]: 60,
[CHAIN_IDs.INK]: 60, // Follows Optimism
[CHAIN_IDs.LINEA]: 1,
[CHAIN_IDs.LISK]: 60,
[CHAIN_IDs.MAINNET]: 16, // Mainnet reorgs are rarely > 4 blocks in depth so this is a very safe buffer
Expand Down Expand Up @@ -125,6 +128,7 @@ export const CHAIN_MAX_BLOCK_LOOKBACK = {
[CHAIN_IDs.BASE]: 10000,
[CHAIN_IDs.BLAST]: 10000,
[CHAIN_IDs.BOBA]: 4990,
[CHAIN_IDs.INK]: 10000,
[CHAIN_IDs.LINEA]: 5000,
[CHAIN_IDs.LISK]: 10000,
[CHAIN_IDs.MAINNET]: 5000,
Expand All @@ -140,6 +144,7 @@ export const CHAIN_MAX_BLOCK_LOOKBACK = {
[CHAIN_IDs.ARBITRUM_SEPOLIA]: 10000,
[CHAIN_IDs.BASE_SEPOLIA]: 10000,
[CHAIN_IDs.BLAST_SEPOLIA]: 10000,
[CHAIN_IDs.INK_SEPOLIA]: 10000,
[CHAIN_IDs.LISK_SEPOLIA]: 10000,
[CHAIN_IDs.MODE_SEPOLIA]: 10000,
[CHAIN_IDs.OPTIMISM_SEPOLIA]: 10000,
Expand All @@ -159,6 +164,7 @@ export const BUNDLE_END_BLOCK_BUFFERS = {
[CHAIN_IDs.BOBA]: 0, // **UPDATE** 288 is disabled so there should be no buffer.
[CHAIN_IDs.LINEA]: 40, // At 3s/block, 2 mins = 40 blocks.
[CHAIN_IDs.LISK]: 60, // 2s/block gives 2 mins buffer time.
[CHAIN_IDs.INK]: 120, // 1s/block gives 2 mins buffer time
james-a-morris marked this conversation as resolved.
Show resolved Hide resolved
[CHAIN_IDs.MAINNET]: 5, // 12s/block
[CHAIN_IDs.MODE]: 60, // 2s/block. Same finality profile as Optimism
[CHAIN_IDs.OPTIMISM]: 60, // 2s/block
Expand All @@ -172,6 +178,7 @@ export const BUNDLE_END_BLOCK_BUFFERS = {
[CHAIN_IDs.ARBITRUM_SEPOLIA]: 0,
[CHAIN_IDs.BASE_SEPOLIA]: 0,
[CHAIN_IDs.BLAST_SEPOLIA]: 0,
[CHAIN_IDs.INK_SEPOLIA]: 0,
[CHAIN_IDs.LISK_SEPOLIA]: 0,
[CHAIN_IDs.MODE_SEPOLIA]: 0,
[CHAIN_IDs.OPTIMISM_SEPOLIA]: 0,
Expand Down Expand Up @@ -203,6 +210,7 @@ export const CHAIN_CACHE_FOLLOW_DISTANCE: { [chainId: number]: number } = {
[CHAIN_IDs.BASE]: 120,
[CHAIN_IDs.BLAST]: 120,
[CHAIN_IDs.BOBA]: 0,
[CHAIN_IDs.INK]: 120, // Follows Optimism
[CHAIN_IDs.LISK]: 120,
[CHAIN_IDs.LINEA]: 100, // Linea has a soft-finality of 1 block. This value is padded - but at 3s/block the padding is 5 minutes
[CHAIN_IDs.MAINNET]: 128,
Expand All @@ -218,6 +226,7 @@ export const CHAIN_CACHE_FOLLOW_DISTANCE: { [chainId: number]: number } = {
[CHAIN_IDs.ARBITRUM_SEPOLIA]: 0,
[CHAIN_IDs.BASE_SEPOLIA]: 0,
[CHAIN_IDs.BLAST_SEPOLIA]: 0,
[CHAIN_IDs.INK_SEPOLIA]: 0,
[CHAIN_IDs.LISK_SEPOLIA]: 0,
[CHAIN_IDs.MODE_SEPOLIA]: 0,
[CHAIN_IDs.OPTIMISM_SEPOLIA]: 0,
Expand All @@ -234,6 +243,7 @@ export const DEFAULT_NO_TTL_DISTANCE: { [chainId: number]: number } = {
[CHAIN_IDs.BASE]: 86400,
[CHAIN_IDs.BLAST]: 86400,
[CHAIN_IDs.BOBA]: 86400,
[CHAIN_IDs.INK]: 86400,
[CHAIN_IDs.LINEA]: 57600,
[CHAIN_IDs.LISK]: 86400,
[CHAIN_IDs.MAINNET]: 14400,
Expand All @@ -253,6 +263,7 @@ export const DEFAULT_GAS_FEE_SCALERS: {
} = {
[CHAIN_IDs.BASE]: { maxFeePerGasScaler: 2, maxPriorityFeePerGasScaler: 0.01 },
[CHAIN_IDs.BLAST]: { maxFeePerGasScaler: 2, maxPriorityFeePerGasScaler: 0.01 },
[CHAIN_IDs.INK]: { maxFeePerGasScaler: 2, maxPriorityFeePerGasScaler: 0.01 },
[CHAIN_IDs.LISK]: { maxFeePerGasScaler: 2, maxPriorityFeePerGasScaler: 0.01 },
[CHAIN_IDs.MAINNET]: { maxFeePerGasScaler: 3, maxPriorityFeePerGasScaler: 1.2 },
[CHAIN_IDs.MODE]: { maxFeePerGasScaler: 2, maxPriorityFeePerGasScaler: 0.01 },
Expand All @@ -274,6 +285,7 @@ export const PROVIDER_CACHE_TTL_MODIFIER = 0.15;
export const spokesThatHoldEthAndWeth = [
CHAIN_IDs.BASE,
CHAIN_IDs.BLAST,
CHAIN_IDs.INK,
CHAIN_IDs.LINEA,
CHAIN_IDs.LISK,
CHAIN_IDs.MODE,
Expand Down Expand Up @@ -310,6 +322,7 @@ export const SUPPORTED_TOKENS: { [chainId: number]: string[] } = {
[CHAIN_IDs.ARBITRUM]: ["USDC", "USDT", "WETH", "DAI", "WBTC", "UMA", "BAL", "ACX", "POOL"],
[CHAIN_IDs.BASE]: ["BAL", "DAI", "ETH", "WETH", "USDC", "POOL"],
[CHAIN_IDs.BLAST]: ["DAI", "WBTC", "WETH"],
[CHAIN_IDs.INK]: ["ETH", "WETH"],
[CHAIN_IDs.LINEA]: ["USDC", "USDT", "WETH", "WBTC", "DAI"],
[CHAIN_IDs.LISK]: ["WETH", "USDT", "LSK", "WBTC"],
[CHAIN_IDs.MODE]: ["ETH", "WETH", "USDC", "USDT", "WBTC"],
Expand Down Expand Up @@ -364,6 +377,7 @@ export const CANONICAL_BRIDGE: {
[CHAIN_IDs.ARBITRUM]: ArbitrumOrbitBridge,
[CHAIN_IDs.BASE]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.BLAST]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.INK]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.LINEA]: LineaBridge,
[CHAIN_IDs.LISK]: OpStackDefaultERC20Bridge,
[CHAIN_IDs.MODE]: OpStackDefaultERC20Bridge,
Expand Down Expand Up @@ -402,6 +416,9 @@ export const CUSTOM_BRIDGE: {
[TOKEN_SYMBOLS_MAP.DAI.addresses[CHAIN_IDs.MAINNET]]: BlastBridge,
[TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.MAINNET]]: OpStackWethBridge,
},
[CHAIN_IDs.INK]: {
[TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.MAINNET]]: OpStackWethBridge,
},
[CHAIN_IDs.LINEA]: {
[TOKEN_SYMBOLS_MAP.USDC.addresses[CHAIN_IDs.MAINNET]]: LineaUSDCBridge,
[TOKEN_SYMBOLS_MAP.WETH.addresses[CHAIN_IDs.MAINNET]]: LineaWethBridge,
Expand Down Expand Up @@ -505,6 +522,7 @@ export const EXPECTED_L1_TO_L2_MESSAGE_TIME = {
[CHAIN_IDs.ARBITRUM]: 20 * 60,
[CHAIN_IDs.BASE]: 20 * 60,
[CHAIN_IDs.BLAST]: 20 * 60,
[CHAIN_IDs.INK]: 20 * 60,
[CHAIN_IDs.LINEA]: 60 * 60,
[CHAIN_IDs.LISK]: 20 * 60,
[CHAIN_IDs.MODE]: 20 * 60,
Expand Down Expand Up @@ -598,11 +616,27 @@ export const OPSTACK_CONTRACT_OVERRIDES = {
},
l2: DEFAULT_L2_CONTRACT_ADDRESSES,
},
[CHAIN_IDs.INK]: {
l1: {
AddressManager: "0x9b7c9bbd6d540a8a4dedd935819fc4408ba71153",
L1CrossDomainMessenger: "0x69d3cf86b2bf1a9e99875b7e2d9b6a84426c171f",
L1StandardBridge: CONTRACT_ADDRESSES[CHAIN_IDs.MAINNET].ovmStandardBridge_57073.address,
StateCommitmentChain: ZERO_ADDRESS,
CanonicalTransactionChain: ZERO_ADDRESS,
BondManager: ZERO_ADDRESS,
OptimismPortal: "0x5d66c1782664115999c47c9fa5cd031f495d3e4f",
L2OutputOracle: ZERO_ADDRESS,
james-a-morris marked this conversation as resolved.
Show resolved Hide resolved
OptimismPortal2: ZERO_ADDRESS,
DisputeGameFactory: "0x10d7b35078d3baabb96dd45a9143b94be65b12cd",
},
l2: DEFAULT_L2_CONTRACT_ADDRESSES,
},
};

export const DEFAULT_GAS_MULTIPLIER: { [chainId: number]: number } = {
[CHAIN_IDs.OPTIMISM]: 1.5,
[CHAIN_IDs.BASE]: 1.5,
[CHAIN_IDs.INK]: 1.5,
[CHAIN_IDs.LISK]: 1.5,
[CHAIN_IDs.MODE]: 1.5,
[CHAIN_IDs.REDSTONE]: 1.5,
Expand Down
13 changes: 13 additions & 0 deletions src/common/ContractAddresses.ts
Original file line number Diff line number Diff line change
Expand Up @@ -109,6 +109,10 @@ export const CONTRACT_ADDRESSES: {
address: "0x735aDBbE72226BD52e818E7181953f42E3b0FF21",
abi: OVM_L1_STANDARD_BRIDGE_ABI,
},
ovmStandardBridge_57073: {
address: "0x88ff1e5b602916615391f55854588efcbb7663f0",
abi: OVM_L1_STANDARD_BRIDGE_ABI,
},
ovmStandardBridge_81457: {
address: "0x697402166Fbf2F22E970df8a6486Ef171dbfc524",
abi: OVM_L1_STANDARD_BRIDGE_ABI,
Expand Down Expand Up @@ -311,6 +315,15 @@ export const CONTRACT_ADDRESSES: {
address: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
},
},
57073: {
ovmStandardBridge: {
address: "0x4200000000000000000000000000000000000010",
abi: OVM_L2_STANDARD_BRIDGE_ABI,
},
eth: {
address: "0xDeadDeAddeAddEAddeadDEaDDEAdDeaDDeAD0000",
},
},
81457: {
ovmStandardBridge: {
address: "0x4200000000000000000000000000000000000010",
Expand Down
4 changes: 4 additions & 0 deletions src/finalizer/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -120,6 +120,10 @@ const chainFinalizers: { [chainId: number]: { finalizeOnL2: ChainFinalizer[]; fi
finalizeOnL1: [opStackFinalizer],
finalizeOnL2: [],
},
[CHAIN_IDs.INK]: {
finalizeOnL1: [opStackFinalizer],
finalizeOnL2: [],
},
// Testnets
[CHAIN_IDs.BASE_SEPOLIA]: {
finalizeOnL1: [cctpL2toL1Finalizer],
Expand Down
30 changes: 15 additions & 15 deletions yarn.lock
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,10 @@
"@uma/common" "^2.17.0"
hardhat "^2.9.3"

"@across-protocol/constants@^3.1.22":
version "3.1.22"
resolved "https://registry.yarnpkg.com/@across-protocol/constants/-/constants-3.1.22.tgz#888fb6852b9781aa9f872ac44e888d7bf2a643c7"
integrity sha512-l9CteL0FGHPPIbLaAztANpm/uNk8jV7hmDuecAToZdqAgqcN9E9Hfi44Fflr6H882uVsNlTU0/h1oWkTeifUnA==
"@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/contracts@^0.1.4":
version "0.1.4"
Expand All @@ -25,12 +25,12 @@
"@openzeppelin/contracts" "4.1.0"
"@uma/core" "^2.18.0"

"@across-protocol/contracts@^3.0.18":
version "3.0.18"
resolved "https://registry.yarnpkg.com/@across-protocol/contracts/-/contracts-3.0.18.tgz#b5acbebcb249b193a4d9a019a7cd5af00131a70b"
integrity sha512-4eWgmK8D33ezNZPx/ePLnh3Za0FfcHj5mmDK5FfWbeOM+AjXOzV7miV2/xBcEZXclhIc52e3GcPdbegI15lA2w==
"@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==
dependencies:
"@across-protocol/constants" "^3.1.22"
"@across-protocol/constants" "^3.1.24"
"@coral-xyz/anchor" "^0.30.1"
"@defi-wonderland/smock" "^2.3.4"
"@eth-optimism/contracts" "^0.5.40"
Expand All @@ -53,14 +53,14 @@
yargs "^17.7.2"
zksync-web3 "^0.14.3"

"@across-protocol/sdk@^3.3.26":
version "3.3.26"
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.3.26.tgz#b33aaf1545af9ff2969dd99db5ac39f3d785f689"
integrity sha512-RaEkwtme9k24NAQDKWTFaywrhQd7RqxRRitRwSXoiGm6Aw4iOXHoh/CjT3Z1wjcCBxHVeRozYUXESQlJZ+dOTw==
"@across-protocol/sdk@^3.3.27":
version "3.3.27"
resolved "https://registry.yarnpkg.com/@across-protocol/sdk/-/sdk-3.3.27.tgz#ca58012c30e7d489ba5493981447c8cf2b82ef58"
integrity sha512-TebERt9Z0CF3NzD4dkurrgEqHn7gqidgoUrvk0kMUy2HzrlZilYj3oKgn+Kevn4XqomPfdWOkuAyiWDV5uNYew==
dependencies:
"@across-protocol/across-token" "^1.0.0"
"@across-protocol/constants" "^3.1.22"
"@across-protocol/contracts" "^3.0.18"
"@across-protocol/constants" "^3.1.24"
"@across-protocol/contracts" "^3.0.19"
"@eth-optimism/sdk" "^3.3.1"
"@ethersproject/bignumber" "^5.7.0"
"@pinata/sdk" "^2.1.0"
Expand Down
Loading