Skip to content

Commit 39961bd

Browse files
authored
improve: store across protocol deployments in deployments.json over consts.ts (#1101)
* move AdapterStore from consts.ts to deployments.json Signed-off-by: Ihor Farion <ihor@umaproject.org> * hubpoolstore Signed-off-by: Ihor Farion <ihor@umaproject.org> * helios Signed-off-by: Ihor Farion <ihor@umaproject.org> * fix throwOnError Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org>
1 parent 6560477 commit 39961bd

File tree

6 files changed

+21
-13
lines changed

6 files changed

+21
-13
lines changed

deploy/004_deploy_arbitrum_adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,7 @@
11
import { CHAIN_IDs } from "@across-protocol/constants";
22
import { getOftEid, toWei } from "../utils/utils";
33
import { L1_ADDRESS_MAP, USDC } from "./consts";
4+
import { getDeployedAddress } from "../src/DeploymentUtils";
45
import { DeployFunction } from "hardhat-deploy/types";
56
import { HardhatRuntimeEnvironment } from "hardhat/types";
67

@@ -16,14 +17,15 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1617

1718
const oftDstEid = getOftEid(spokeChainId);
1819
const oftFeeCap = toWei("1"); // 1 eth transfer fee cap
20+
const adapterStore = getDeployedAddress("AdapterStore", chainId);
1921

2022
const args = [
2123
L1_ADDRESS_MAP[chainId].l1ArbitrumInbox,
2224
L1_ADDRESS_MAP[chainId].l1ERC20GatewayRouter,
2325
l2RefundAddress,
2426
USDC[chainId],
2527
L1_ADDRESS_MAP[chainId].cctpTokenMessenger,
26-
L1_ADDRESS_MAP[chainId].adapterStore,
28+
adapterStore,
2729
oftDstEid,
2830
oftFeeCap,
2931
];

deploy/009_deploy_polygon_adapter.ts

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
33
import { CHAIN_IDs, TOKEN_SYMBOLS_MAP } from "../utils";
44
import { getOftEid, toWei } from "../utils/utils";
55
import { L1_ADDRESS_MAP, USDC, WETH } from "./consts";
6+
import { getDeployedAddress } from "../src/DeploymentUtils";
67

78
const MATIC = TOKEN_SYMBOLS_MAP.MATIC.addresses;
89

@@ -14,6 +15,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1415

1516
const oftDstEid = getOftEid(spokeChainId);
1617
const oftFeeCap = toWei("1"); // 1 eth transfer fee cap
18+
const adapterStore = getDeployedAddress("AdapterStore", chainId);
1719

1820
const args = [
1921
L1_ADDRESS_MAP[chainId].polygonRootChainManager,
@@ -24,7 +26,7 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2426
WETH[chainId],
2527
USDC[chainId],
2628
L1_ADDRESS_MAP[chainId].cctpTokenMessenger,
27-
L1_ADDRESS_MAP[chainId].adapterStore,
29+
adapterStore,
2830
oftDstEid,
2931
oftFeeCap,
3032
];

deploy/110_deploy_universal_adapter.ts

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,7 @@ import { CIRCLE_DOMAIN_IDs, L1_ADDRESS_MAP, USDC, ZERO_ADDRESS } from "./consts"
55
import { CCTP_NO_DOMAIN } from "@across-protocol/constants";
66
import { CIRCLE_UNINITIALIZED_DOMAIN_ID } from "./consts";
77
import assert from "assert";
8+
import { getDeployedAddress } from "../src/DeploymentUtils";
89

910
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1011
const { SPOKE_CHAIN_ID } = process.env;
@@ -15,23 +16,24 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1516

1617
// Warning: re-using the same HubPoolStore for different L2's is only safe if the L2 spoke pools have
1718
// unique addresses, since the relayed message `targets` are part of the unique data hash.
18-
const hubPoolStore = await hre.deployments.get("HubPoolStore");
19+
const hubPoolStore = getDeployedAddress("HubPoolStore", chainId);
1920

2021
// todo: implement similar treatment to `CIRCLE_DOMAIN_IDs`
2122
const oftDstEid = getOftEid(Number(SPOKE_CHAIN_ID));
2223
const oftFeeCap = toWei("1"); // 1 eth transfer fee cap
24+
const adapterStore = getDeployedAddress("AdapterStore", chainId);
2325

2426
const cctpDomainId = CIRCLE_DOMAIN_IDs[Number(SPOKE_CHAIN_ID)] ?? CCTP_NO_DOMAIN;
2527
const args = [
26-
hubPoolStore.address,
28+
hubPoolStore,
2729
USDC[chainId],
2830
cctpDomainId === CCTP_NO_DOMAIN ? ZERO_ADDRESS : L1_ADDRESS_MAP[chainId].cctpTokenMessenger,
2931
cctpDomainId === CCTP_NO_DOMAIN ? CIRCLE_UNINITIALIZED_DOMAIN_ID : cctpDomainId,
30-
L1_ADDRESS_MAP[chainId].adapterStore,
32+
adapterStore,
3133
oftDstEid,
3234
oftFeeCap,
3335
];
34-
const instance = await deployments.deploy("Universal_Adapter", {
36+
const instance = await hre.deployments.deploy("Universal_Adapter", {
3537
from: deployer,
3638
log: true,
3739
skipIfAlreadyDeployed: false,

deploy/111_deploy_universal_spokepool.ts

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -1,9 +1,10 @@
11
import { DeployFunction } from "hardhat-deploy/types";
22
import { HardhatRuntimeEnvironment } from "hardhat/types";
33
import { deployNewProxy, getSpokePoolDeploymentInfo } from "../utils/utils.hre";
4-
import { FILL_DEADLINE_BUFFER, L1_ADDRESS_MAP, L2_ADDRESS_MAP, QUOTE_TIME_BUFFER, USDC, ZERO_ADDRESS } from "./consts";
4+
import { FILL_DEADLINE_BUFFER, L2_ADDRESS_MAP, QUOTE_TIME_BUFFER, USDC, ZERO_ADDRESS } from "./consts";
55
import { CHAIN_IDs, PRODUCTION_NETWORKS, TOKEN_SYMBOLS_MAP } from "../utils/constants";
66
import { getOftEid, toWei } from "../utils/utils";
7+
import { getDeployedAddress } from "../src/DeploymentUtils";
78

89
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
910
const { hubPool, hubChainId, spokeChainId } = await getSpokePoolDeploymentInfo(hre);
@@ -30,10 +31,12 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
3031
// ! Notice. Deployed has to adjust this fee cap based on dst chain's native token. 4.4 BNB for BSC
3132
const oftFeeCap = toWei(4.4); // ~1 ETH fee cap
3233

34+
const heliosAddress = getDeployedAddress("Helios", spokeChainId);
35+
3336
const constructorArgs = [
3437
24 * 60 * 60, // 1 day; Helios latest head timestamp must be 1 day old before an admin can force execute a message.
35-
L2_ADDRESS_MAP[spokeChainId]?.helios,
36-
L1_ADDRESS_MAP[CHAIN_IDs.MAINNET]?.hubPoolStore,
38+
heliosAddress,
39+
getDeployedAddress("HubPoolStore", hubChainId),
3740
expectedWrappedNative,
3841
QUOTE_TIME_BUFFER,
3942
FILL_DEADLINE_BUFFER,

deploy/consts.ts

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -45,8 +45,6 @@ export const L1_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
4545
l1AlephZeroInbox: "0x56D8EC76a421063e1907503aDd3794c395256AEb",
4646
l1AlephZeroERC20GatewayRouter: "0xeBb17f398ed30d02F2e8733e7c1e5cf566e17812",
4747
donationBox: "0x0d57392895Db5aF3280e9223323e20F3951E81B1",
48-
adapterStore: "0x42df4D71f35ffBD28ae217d52E83C1DA0007D63b",
49-
hubPoolStore: "0x1Ace3BbD69b63063F859514Eca29C9BDd8310E61",
5048
zkBridgeHub: "0x303a465B659cBB0ab36eE643eA362c509EEb5213",
5149
zkUsdcSharedBridge_232: "0xf553E6D903AA43420ED7e3bc2313bE9286A8F987",
5250
zkUsdcSharedBridge_324: "0xD7f9f54194C633F36CCD5F3da84ad4a1c38cB2cB", // This is the standard shared bridge contract.
@@ -184,7 +182,6 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
184182
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
185183
},
186184
[CHAIN_IDs.BSC]: {
187-
helios: "0xE58480CA74f1A819faFd777BEDED4E2D5629943d",
188185
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
189186
},
190187
[CHAIN_IDs.POLYGON]: {

deployments/deployments.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"1": {
33
"AcrossConfigStore": { "address": "0x3B03509645713718B78951126E0A6de6f10043f5", "blockNumber": 14717196 },
44
"AcrossMerkleDistributor": { "address": "0xE50b2cEAC4f60E840Ae513924033E753e2366487", "blockNumber": 15976846 },
5+
"AdapterStore": { "address": "0x42df4D71f35ffBD28ae217d52E83C1DA0007D63b", "blockNumber": 23086526 },
56
"Arbitrum_Adapter": { "address": "0x5eC9844936875E27eBF22172f4d92E107D35B57C", "blockNumber": 23086601 },
67
"Arbitrum_RescueAdapter": { "address": "0xC6fA0a4EBd802c01157d6E7fB1bbd2ae196ae375", "blockNumber": 16233939 },
78
"Arbitrum_SendTokensAdapter": { "address": "0xC06A68DF12376271817FcEBfb45Be996B0e1593E", "blockNumber": 16691987 },
@@ -55,7 +56,8 @@
5556
"SpokePool": { "address": "0x4e8E101924eDE233C13e2D8622DC8aED2872d505", "blockNumber": 48762335 },
5657
"SpokePoolVerifier": { "address": "0x3Fb9cED51E968594C87963a371Ed90c39519f65A", "blockNumber": 49157612 },
5758
"MulticallHandler": { "address": "0xAC537C12fE8f544D712d71ED4376a502EEa944d7", "blockNumber": 48762440 },
58-
"SpokePoolPeriphery": { "address": "0x89415a82d909a7238d69094C3Dd1dCC1aCbDa85C", "blockNumber": 52135703 }
59+
"SpokePoolPeriphery": { "address": "0x89415a82d909a7238d69094C3Dd1dCC1aCbDa85C", "blockNumber": 52135703 },
60+
"Helios": { "address": "0xE58480CA74f1A819faFd777BEDED4E2D5629943d", "blockNumber": 59344945 }
5961
},
6062
"137": {
6163
"MintableERC1155": { "address": "0xA15a90E7936A2F8B70E181E955760860D133e56B", "blockNumber": 40600414 },

0 commit comments

Comments
 (0)