Skip to content

Commit caea579

Browse files
committed
Adds WstETHApi3ReaderProxyV1 deploy script
1 parent 28eb274 commit caea579

File tree

2 files changed

+46
-0
lines changed

2 files changed

+46
-0
lines changed
Lines changed: 45 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,45 @@
1+
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
2+
3+
// Note: getDeploymentName is not strictly needed here as there are no constructor args,
4+
// but kept for potential future consistency if desired. For no-arg singletons,
5+
// using the contract name directly as the deployment name is often simplest.
6+
// import { getDeploymentName } from '../src/deployment';
7+
8+
const CONTRACT_NAME = 'WstETHApi3ReaderProxyV1';
9+
10+
module.exports = async (hre: HardhatRuntimeEnvironment) => {
11+
const { getUnnamedAccounts, deployments, network, run } = hre;
12+
const { deploy, log } = deployments;
13+
14+
const [deployerAddress] = await getUnnamedAccounts();
15+
if (!deployerAddress) {
16+
throw new Error('No deployer address found.');
17+
}
18+
log(`Deployer address: ${deployerAddress}`);
19+
20+
const isLocalNetwork = network.name === 'hardhat' || network.name === 'localhost';
21+
22+
const confirmations = isLocalNetwork ? 1 : 5;
23+
log(`Deployment confirmations: ${confirmations}`);
24+
25+
// For contracts with no constructor args, using the contract name directly is common.
26+
log(`Deployment name for this instance: ${CONTRACT_NAME}`);
27+
28+
const deployment = await deploy(CONTRACT_NAME, {
29+
contract: CONTRACT_NAME,
30+
from: deployerAddress,
31+
log: true,
32+
waitConfirmations: confirmations,
33+
});
34+
35+
if (isLocalNetwork) {
36+
log('Skipping verification on local network.');
37+
return;
38+
}
39+
40+
log(`Attempting verification of ${CONTRACT_NAME} at ${deployment.address} (already waited for confirmations)...`);
41+
await run('verify:verify', {
42+
address: deployment.address,
43+
});
44+
};
45+
module.exports.tags = [CONTRACT_NAME];

package.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -28,6 +28,7 @@
2828
"deploy:NormalizedApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags NormalizedApi3ReaderProxyV1",
2929
"deploy:ProductApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags ProductApi3ReaderProxyV1",
3030
"deploy:ScaledApi3FeedProxyV1": "hardhat deploy --network $NETWORK --tags ScaledApi3FeedProxyV1",
31+
"deploy:WstETHApi3ReaderProxyV1": "hardhat deploy --network $NETWORK --tags WstETHApi3ReaderProxyV1",
3132
"generate:deployment-addresses": "ts-node scripts/generate-deployment-addresses.ts",
3233
"lint": "pnpm run prettier:check && pnpm run lint:eslint && pnpm run lint:solhint",
3334
"lint:solhint": "solhint ./contracts/**/*.sol",

0 commit comments

Comments
 (0)