Skip to content

Commit 042f960

Browse files
committed
fix: hardhat task entries updated for l1-bridge-test and l2-bridge-config scripts
1 parent fa3d2e1 commit 042f960

File tree

3 files changed

+16
-9
lines changed

3 files changed

+16
-9
lines changed

rollup-bridge-contracts/hardhat.config.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -31,6 +31,7 @@ import "./task/set-eth-bridge-dependencies";
3131
import "./task/set-enshrined-token-bridge-dependencies";
3232
import "./task/authorise-l2-bridges-in-messenger";
3333
import "./task/fund-l2-eth-bridge-vault";
34+
import "./task/grant-relayer-role";
3435
import "./task/l2-task-runner";
3536

3637
const config: HardhatUserConfig = {

rollup-bridge-contracts/scripts/bridge-test/bridge-eth.ts

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -41,8 +41,8 @@ export async function bridgeETH() {
4141
// save the nilMessageTree Address in the json config for l2
4242
const l2NetworkConfig: L2NetworkConfig = loadNilNetworkConfig("local");
4343

44-
const l2DepositRecipient = l2NetworkConfig.l2CommonConfig.depositRecipient;
45-
const l2FeeRefundAddress = l2NetworkConfig.l2CommonConfig.feeRefundRecipient;
44+
const l2DepositRecipient = config.l1TestConfig.l2DepositRecipient;
45+
const l2FeeRefundAddress = config.l1TestConfig.l2FeeRefundRecipient;
4646
const eth_amount = config.l1TestConfig.l1ETHDepositTestConfig.amount;
4747
const gasLimit = config.l1TestConfig.l1ETHDepositTestConfig.gasLimit;
4848
const total_native_amount = config.l1TestConfig.l1ETHDepositTestConfig.totalNativeAmount;

rollup-bridge-contracts/task/nil-smart-account.ts

Lines changed: 13 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ import {
1010
waitTillCompleted,
1111
} from "@nilfoundation/niljs";
1212
import "dotenv/config";
13-
import { L2NetworkConfig, loadNilNetworkConfig, saveNilNetworkConfig } from "../deploy/config/config-helper";
13+
import { L2NetworkConfig, loadL1NetworkConfig, loadNilNetworkConfig, saveNilNetworkConfig } from "../deploy/config/config-helper";
1414
import { getCheckSummedAddress } from '../scripts/utils/validate-config';
1515

1616
let smartAccount: SmartAccountV1 | null = null;
@@ -74,10 +74,9 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
7474
PRIVATE_KEY: privateKey,
7575
SMART_ACCOUNT_ADDRESS: smartAccount.address,
7676
}));
77-
console.log("🆕 New Smart Account Generated:", smartAccount.address);
77+
console.log("🆕 owner Smart Account Generated:", smartAccount.address);
7878
}
7979

80-
//DEPOSIT_RECIPIENT_PRIVATE_KEY = "0xe4d6ddfd7479614249381d4bd240fa2408efc53dad5f7f31cb7ae7e5962fc1d0"
8180
const depositRecipientPrivateKey = process.env.DEPOSIT_RECIPIENT_PRIVATE_KEY as `0x${string}`;
8281
let signer = new LocalECDSAKeySigner({ privateKey: depositRecipientPrivateKey });
8382
const depositRecipientSmartAccount = new SmartAccountV1({
@@ -88,11 +87,11 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
8887
pubkey: signer.getPublicKey(),
8988
});
9089
const depositRecipientSmartAccountAddress = depositRecipientSmartAccount.address;
91-
console.log("🆕 New Smart Account Generated:", depositRecipientSmartAccountAddress);
90+
console.log("🆕 depositRecipient Smart Account Generated:", depositRecipientSmartAccountAddress);
9291

9392

9493
const nilFeeRefundAddressPrivateKey = process.env.NIL_FEE_REFUND_PRIVATE_KEY as `0x${string}`;
95-
signer = new LocalECDSAKeySigner({ privateKey: depositRecipientPrivateKey });
94+
signer = new LocalECDSAKeySigner({ privateKey: nilFeeRefundAddressPrivateKey });
9695
const feeRefundSmartAccount = new SmartAccountV1({
9796
signer,
9897
client,
@@ -101,13 +100,17 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
101100
pubkey: signer.getPublicKey(),
102101
});
103102
const feeRefundSmartAccountAddress = feeRefundSmartAccount.address;
103+
console.log("🆕 feeRefund Smart Account Generated:", feeRefundSmartAccountAddress);
104104

105+
console.log(`about to topup owner via faucet`);
105106
const topUpFaucet = await faucetClient.topUp({
106107
smartAccountAddress: smartAccount.address,
107108
amount: convertEthToWei(0.1),
108109
faucetAddress: process.env.NIL as `0x${string}`,
109110
});
110111

112+
console.log(`faucet topup initiation done`);
113+
111114
await waitTillCompleted(client, topUpFaucet);
112115

113116
if ((await smartAccount.checkDeploymentStatus()) === false) {
@@ -121,8 +124,11 @@ export async function generateNilSmartAccount(networkName: string): Promise<Smar
121124

122125
config.l2CommonConfig.owner = getCheckSummedAddress(smartAccountAddress);
123126
config.l2CommonConfig.admin = getCheckSummedAddress(smartAccountAddress);
124-
config.l2CommonConfig.depositRecipient = getCheckSummedAddress(depositRecipientSmartAccountAddress);
125-
config.l2CommonConfig.feeRefundRecipient = getCheckSummedAddress(feeRefundSmartAccountAddress);
127+
128+
const l1Config = loadL1NetworkConfig(networkName);
129+
130+
l1Config.l1TestConfig.l2DepositRecipient = getCheckSummedAddress(depositRecipientSmartAccountAddress);
131+
l1Config.l1TestConfig.l2FeeRefundRecipient = getCheckSummedAddress(feeRefundSmartAccountAddress);
126132

127133
// Save the updated config
128134
saveNilNetworkConfig(networkName, config);

0 commit comments

Comments
 (0)