Skip to content

Commit 6560477

Browse files
authored
chore: deploy new BSC contracts (#1091)
* deploy Universal_SpokePool on BSC Signed-off-by: Ihor Farion <ihor@umaproject.org> * deploy Universal_Adapter for BSC Signed-off-by: Ihor Farion <ihor@umaproject.org> * remove unneeded deployment flag requirement Signed-off-by: Ihor Farion <ihor@umaproject.org> --------- Signed-off-by: Ihor Farion <ihor@umaproject.org>
1 parent c441b3d commit 6560477

File tree

8 files changed

+505
-29
lines changed

8 files changed

+505
-29
lines changed

deploy/110_deploy_universal_adapter.ts

Lines changed: 13 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,9 @@
11
import { DeployFunction } from "hardhat-deploy/types";
2+
import { getOftEid, toWei } from "../utils/utils";
23
import { HardhatRuntimeEnvironment } from "hardhat/types";
34
import { CIRCLE_DOMAIN_IDs, L1_ADDRESS_MAP, USDC, ZERO_ADDRESS } from "./consts";
5+
import { CCTP_NO_DOMAIN } from "@across-protocol/constants";
6+
import { CIRCLE_UNINITIALIZED_DOMAIN_ID } from "./consts";
47
import assert from "assert";
58

69
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
@@ -14,11 +17,19 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1417
// unique addresses, since the relayed message `targets` are part of the unique data hash.
1518
const hubPoolStore = await hre.deployments.get("HubPoolStore");
1619

20+
// todo: implement similar treatment to `CIRCLE_DOMAIN_IDs`
21+
const oftDstEid = getOftEid(Number(SPOKE_CHAIN_ID));
22+
const oftFeeCap = toWei("1"); // 1 eth transfer fee cap
23+
24+
const cctpDomainId = CIRCLE_DOMAIN_IDs[Number(SPOKE_CHAIN_ID)] ?? CCTP_NO_DOMAIN;
1725
const args = [
1826
hubPoolStore.address,
1927
USDC[chainId],
20-
CIRCLE_DOMAIN_IDs[SPOKE_CHAIN_ID] ? L1_ADDRESS_MAP[chainId].cctpTokenMessenger : ZERO_ADDRESS,
21-
CIRCLE_DOMAIN_IDs[SPOKE_CHAIN_ID] ?? 4294967295, // maxUint32,
28+
cctpDomainId === CCTP_NO_DOMAIN ? ZERO_ADDRESS : L1_ADDRESS_MAP[chainId].cctpTokenMessenger,
29+
cctpDomainId === CCTP_NO_DOMAIN ? CIRCLE_UNINITIALIZED_DOMAIN_ID : cctpDomainId,
30+
L1_ADDRESS_MAP[chainId].adapterStore,
31+
oftDstEid,
32+
oftFeeCap,
2233
];
2334
const instance = await deployments.deploy("Universal_Adapter", {
2435
from: deployer,

deploy/111_deploy_universal_spokepool.ts

Lines changed: 15 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,9 +3,17 @@ import { HardhatRuntimeEnvironment } from "hardhat/types";
33
import { deployNewProxy, getSpokePoolDeploymentInfo } from "../utils/utils.hre";
44
import { FILL_DEADLINE_BUFFER, L1_ADDRESS_MAP, L2_ADDRESS_MAP, QUOTE_TIME_BUFFER, USDC, ZERO_ADDRESS } from "./consts";
55
import { CHAIN_IDs, PRODUCTION_NETWORKS, TOKEN_SYMBOLS_MAP } from "../utils/constants";
6+
import { getOftEid, toWei } from "../utils/utils";
67

78
const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
8-
const { hubPool, spokeChainId } = await getSpokePoolDeploymentInfo(hre);
9+
const { hubPool, hubChainId, spokeChainId } = await getSpokePoolDeploymentInfo(hre);
10+
if (spokeChainId == CHAIN_IDs.BSC) {
11+
console.log("For BSC deployment to work, `hardhat.config.ts` might need a tweak");
12+
// Set these in hardhat.config.ts networks.bsc
13+
// gas: "auto",
14+
// gasPrice: 3e8, // 0.3 GWEI
15+
// gasMultiplier: 4.0,
16+
}
917

1018
const initArgs = [1, hubPool.address, hubPool.address];
1119

@@ -18,6 +26,10 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
1826
throw new Error(`Wrapped native token not found for ${wrappedNativeSymbol} on chainId ${spokeChainId}`);
1927
}
2028

29+
const oftEid = getOftEid(hubChainId);
30+
// ! Notice. Deployed has to adjust this fee cap based on dst chain's native token. 4.4 BNB for BSC
31+
const oftFeeCap = toWei(4.4); // ~1 ETH fee cap
32+
2133
const constructorArgs = [
2234
24 * 60 * 60, // 1 day; Helios latest head timestamp must be 1 day old before an admin can force execute a message.
2335
L2_ADDRESS_MAP[spokeChainId]?.helios,
@@ -27,6 +39,8 @@ const func: DeployFunction = async function (hre: HardhatRuntimeEnvironment) {
2739
FILL_DEADLINE_BUFFER,
2840
USDC[spokeChainId] ?? ZERO_ADDRESS,
2941
L2_ADDRESS_MAP[spokeChainId]?.cctpTokenMessenger ?? ZERO_ADDRESS,
42+
oftEid,
43+
oftFeeCap,
3044
];
3145
console.log(`Deploying new Universal SpokePool on ${spokeChainId} with args:`, constructorArgs);
3246

deploy/consts.ts

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -184,7 +184,7 @@ export const L2_ADDRESS_MAP: { [key: number]: { [contractName: string]: string }
184184
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
185185
},
186186
[CHAIN_IDs.BSC]: {
187-
helios: "0xB04926aF663cB52899361B1F6313bcFEa5A58B29",
187+
helios: "0xE58480CA74f1A819faFd777BEDED4E2D5629943d",
188188
permit2: "0x000000000022D473030F116dDEE9F6B43aC78BA3",
189189
},
190190
[CHAIN_IDs.POLYGON]: {

deployments/bsc/Universal_SpokePool.json

Lines changed: 158 additions & 6 deletions
Large diffs are not rendered by default.

deployments/bsc/solcInputs/03f0774c8f215de67810f48bdf2a5cfe.json

Lines changed: 168 additions & 0 deletions
Large diffs are not rendered by default.

deployments/deployments.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,7 @@
2222
"Mode_Adapter": { "address": "0xf1B59868697f3925b72889ede818B9E7ba0316d0", "blockNumber": 19914094 },
2323
"MulticallHandler": { "address": "0x924a9f036260DdD5808007E1AA95f08eD08aA569", "blockNumber": 20277013 },
2424
"Lisk_Adapter": { "address": "0xF039AdCC74936F90fE175e8b3FE0FdC8b8E0c73b", "blockNumber": 22474211 },
25-
"Universal_Adapter": { "address": "0x22001f37B586792F25Ef9d19d99537C6446e0833", "blockNumber": 22368546 },
25+
"Universal_Adapter": { "address": "0x6f1C9d3bcDF51316E7b515a62C02F601500b084b", "blockNumber": 23251254 },
2626
"Blast_Adapter": { "address": "0xF2bEf5E905AAE0295003ab14872F811E914EdD81", "blockNumber": 20221494 },
2727
"Scroll_Adapter": { "address": "0x2DA799c2223c6ffB595e578903AE6b95839160d8", "blockNumber": 22325451 },
2828
"Blast_DaiRetriever": { "address": "0x98Dd57048d7d5337e92D9102743528ea4Fea64aB", "blockNumber": 20378862 },

deployments/mainnet/Universal_Adapter.json

Lines changed: 144 additions & 16 deletions
Large diffs are not rendered by default.

hardhat.config.ts

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,5 @@
11
import * as dotenv from "dotenv";
2+
dotenv.config();
23
import { HardhatUserConfig } from "hardhat/config";
34
import { CHAIN_IDs, PUBLIC_NETWORKS } from "./utils/constants";
45

@@ -47,8 +48,6 @@ const tasks = [
4748
// eslint-disable-next-line node/no-missing-require
4849
tasks.forEach((task) => require(`./tasks/${task}`));
4950

50-
dotenv.config();
51-
5251
const isTest = process.env.IS_TEST === "true" || process.env.CI === "true";
5352

5453
// To compile with zksolc, `hardhat` must be the default network and its `zksync` property must be true.
@@ -199,6 +198,10 @@ const config: HardhatUserConfig = {
199198
companionNetworks: { l1: "mainnet" },
200199
},
201200
bsc: {
201+
// ! Notice. Params below helped deploy Universal_Spoke on BSC, but might not be desirable always
202+
// gas: "auto",
203+
// gasPrice: 3e8, // 0.3 GWEI
204+
// gasMultiplier: 4.0,
202205
chainId: CHAIN_IDs.BSC,
203206
url: getNodeUrl(CHAIN_IDs.BSC),
204207
saveDeployments: true,

0 commit comments

Comments
 (0)