Skip to content

Commit 9a737e6

Browse files
committed
Moves contract name to module constant in deploy scripts
1 parent abeb310 commit 9a737e6

File tree

4 files changed

+26
-30
lines changed

4 files changed

+26
-30
lines changed

deploy/001_deploy_InverseApi3ReaderProxyV1.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { HardhatRuntimeEnvironment } from 'hardhat/types';
22

33
import { getDeploymentName } from '../src';
44

5-
const VERIFICATION_BLOCK_CONFIRMATIONS = 5;
5+
export const CONTRACT_NAME = 'InverseApi3ReaderProxyV1';
66

77
module.exports = async (hre: HardhatRuntimeEnvironment) => {
88
const { getUnnamedAccounts, deployments, ethers, network, run } = hre;
@@ -25,18 +25,17 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
2525

2626
const isLocalNetwork = network.name === 'hardhat' || network.name === 'localhost';
2727

28-
const confirmations = isLocalNetwork ? 1 : VERIFICATION_BLOCK_CONFIRMATIONS;
28+
const confirmations = isLocalNetwork ? 1 : 5;
2929
log(`Deployment confirmations: ${confirmations}`);
3030

31-
const contractName = 'InverseApi3ReaderProxyV1';
3231
const constructorArgs = [proxyAddress];
3332
const constructorArgTypes = ['address'];
3433

35-
const deploymentName = getDeploymentName(contractName, constructorArgTypes, constructorArgs);
34+
const deploymentName = getDeploymentName(CONTRACT_NAME, constructorArgTypes, constructorArgs);
3635
log(`Generated deterministic deployment name for this instance: ${deploymentName}`);
3736

3837
const deployment = await deploy(deploymentName, {
39-
contract: contractName,
38+
contract: CONTRACT_NAME,
4039
from: deployerAddress,
4140
args: constructorArgs,
4241
log: true,
@@ -49,11 +48,11 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
4948
}
5049

5150
log(
52-
`Attempting verification of ${deploymentName} (contract type ${contractName}) at ${deployment.address} (already waited for confirmations)...`
51+
`Attempting verification of ${deploymentName} (contract type ${CONTRACT_NAME}) at ${deployment.address} (already waited for confirmations)...`
5352
);
5453
await run('verify:verify', {
5554
address: deployment.address,
5655
constructorArguments: deployment.args,
5756
});
5857
};
59-
module.exports.tags = ['InverseApi3ReaderProxyV1'];
58+
module.exports.tags = [CONTRACT_NAME];

deploy/002_deploy_NormalizedApi3ReaderProxyV1.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
22
import type { DeploymentsExtension } from 'hardhat-deploy/types';
33

4-
const VERIFICATION_BLOCK_CONFIRMATIONS = 5;
5-
64
import { getDeploymentName } from '../src';
75

6+
export const CONTRACT_NAME = 'NormalizedApi3ReaderProxyV1';
7+
88
const deployTestFeed = async (deployments: DeploymentsExtension, deployerAddress: string) => {
99
const { address: scaledApi3FeedProxyV1Address } = await deployments.get('ScaledApi3FeedProxyV1').catch(async () => {
1010
return deployments.deploy('ScaledApi3FeedProxyV1', {
@@ -40,18 +40,17 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
4040

4141
const isLocalNetwork = network.name === 'hardhat' || network.name === 'localhost';
4242

43-
const confirmations = isLocalNetwork ? 1 : VERIFICATION_BLOCK_CONFIRMATIONS;
43+
const confirmations = isLocalNetwork ? 1 : 5;
4444
log(`Deployment confirmations: ${confirmations}`);
4545

46-
const contractName = 'NormalizedApi3ReaderProxyV1';
4746
const constructorArgs = [feedAddress];
4847
const constructorArgTypes = ['address'];
4948

50-
const deploymentName = getDeploymentName(contractName, constructorArgTypes, constructorArgs);
49+
const deploymentName = getDeploymentName(CONTRACT_NAME, constructorArgTypes, constructorArgs);
5150
log(`Generated deterministic deployment name for this instance: ${deploymentName}`);
5251

5352
const deployment = await deploy(deploymentName, {
54-
contract: contractName,
53+
contract: CONTRACT_NAME,
5554
from: deployerAddress,
5655
args: constructorArgs,
5756
log: true,
@@ -64,11 +63,11 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
6463
}
6564

6665
log(
67-
`Attempting verification of ${deploymentName} (contract type ${contractName}) at ${deployment.address} (already waited for confirmations)...`
66+
`Attempting verification of ${deploymentName} (contract type ${CONTRACT_NAME}) at ${deployment.address} (already waited for confirmations)...`
6867
);
6968
await run('verify:verify', {
7069
address: deployment.address,
7170
constructorArguments: deployment.args,
7271
});
7372
};
74-
module.exports.tags = ['NormalizedApi3ReaderProxyV1'];
73+
module.exports.tags = [CONTRACT_NAME];

deploy/003_deploy_ProductApi3ReaderProxyV1.ts

Lines changed: 6 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,7 +2,7 @@ import type { HardhatRuntimeEnvironment } from 'hardhat/types';
22

33
import { getDeploymentName } from '../src';
44

5-
const VERIFICATION_BLOCK_CONFIRMATIONS = 5;
5+
export const CONTRACT_NAME = 'ProductApi3ReaderProxyV1';
66

77
module.exports = async (hre: HardhatRuntimeEnvironment) => {
88
const { getUnnamedAccounts, deployments, ethers, network, run } = hre;
@@ -34,18 +34,17 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
3434

3535
const isLocalNetwork = network.name === 'hardhat' || network.name === 'localhost';
3636

37-
const confirmations = isLocalNetwork ? 1 : VERIFICATION_BLOCK_CONFIRMATIONS;
37+
const confirmations = isLocalNetwork ? 1 : 5;
3838
log(`Deployment confirmations: ${confirmations}`);
3939

40-
const contractName = 'ProductApi3ReaderProxyV1';
4140
const constructorArgs = [proxy1Address, proxy2Address];
4241
const constructorArgTypes = ['address', 'address'];
4342

44-
const deploymentName = getDeploymentName(contractName, constructorArgTypes, constructorArgs);
43+
const deploymentName = getDeploymentName(CONTRACT_NAME, constructorArgTypes, constructorArgs);
4544
log(`Generated deterministic deployment name for this instance: ${deploymentName}`);
4645

4746
const deployment = await deploy(deploymentName, {
48-
contract: contractName,
47+
contract: CONTRACT_NAME,
4948
from: deployerAddress,
5049
args: constructorArgs,
5150
log: true,
@@ -58,11 +57,11 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
5857
}
5958

6059
log(
61-
`Attempting verification of ${deploymentName} (contract type ${contractName}) at ${deployment.address} (already waited for confirmations)...`
60+
`Attempting verification of ${deploymentName} (contract type ${CONTRACT_NAME}) at ${deployment.address} (already waited for confirmations)...`
6261
);
6362
await run('verify:verify', {
6463
address: deployment.address,
6564
constructorArguments: deployment.args,
6665
});
6766
};
68-
module.exports.tags = ['ProductApi3ReaderProxyV1'];
67+
module.exports.tags = [CONTRACT_NAME];

deploy/004_deploy_ScaledApi3FeedProxyV1.ts

Lines changed: 7 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
import type { HardhatRuntimeEnvironment } from 'hardhat/types';
22
import type { DeploymentsExtension } from 'hardhat-deploy/types';
33

4-
const VERIFICATION_BLOCK_CONFIRMATIONS = 5;
5-
64
import { getDeploymentName } from '../src';
75

6+
export const CONTRACT_NAME = 'ScaledApi3FeedProxyV1';
7+
88
const deployTestProxy = async (deployments: DeploymentsExtension, deployerAddress: string) => {
99
const { address: inverseApi3ReaderProxyV1Address } = await deployments
1010
.get('InverseApi3ReaderProxyV1')
@@ -46,18 +46,17 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
4646

4747
const isLocalNetwork = network.name === 'hardhat' || network.name === 'localhost';
4848

49-
const confirmations = isLocalNetwork ? 1 : VERIFICATION_BLOCK_CONFIRMATIONS;
49+
const confirmations = isLocalNetwork ? 1 : 5;
5050
log(`Deployment confirmations: ${confirmations}`);
5151

52-
const contractName = 'ScaledApi3FeedProxyV1';
5352
const constructorArgs = [proxyAddress, decimals];
5453
const constructorArgTypes = ['address', 'uint8'];
5554

56-
const deploymentName = getDeploymentName(contractName, constructorArgTypes, constructorArgs);
55+
const deploymentName = getDeploymentName(CONTRACT_NAME, constructorArgTypes, constructorArgs);
5756
log(`Generated deterministic deployment name for this instance: ${deploymentName}`);
5857

5958
const deployment = await deploy(deploymentName, {
60-
contract: contractName,
59+
contract: CONTRACT_NAME,
6160
from: deployerAddress,
6261
args: constructorArgs,
6362
log: true,
@@ -70,11 +69,11 @@ module.exports = async (hre: HardhatRuntimeEnvironment) => {
7069
}
7170

7271
log(
73-
`Attempting verification of ${deploymentName} (contract type ${contractName}) at ${deployment.address} (already waited for confirmations)...`
72+
`Attempting verification of ${deploymentName} (contract type ${CONTRACT_NAME}) at ${deployment.address} (already waited for confirmations)...`
7473
);
7574
await run('verify:verify', {
7675
address: deployment.address,
7776
constructorArguments: deployment.args,
7877
});
7978
};
80-
module.exports.tags = ['ScaledApi3FeedProxyV1'];
79+
module.exports.tags = [CONTRACT_NAME];

0 commit comments

Comments
 (0)