Skip to content

Commit b730a04

Browse files
committed
Add TEST_STAGE support for deploy scripts
1 parent 0897802 commit b730a04

File tree

2 files changed

+15
-1
lines changed

2 files changed

+15
-1
lines changed

deploy/membership.js

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,14 +1,26 @@
1+
const { ethers } = require('hardhat');
12
const { testArgs } = require('../utils/configs');
3+
const { setupProof, membershipMintAndDelegate, isLocalhost } = require('../utils/helpers');
24

3-
module.exports = async ({ getNamedAccounts, deployments }) => {
5+
module.exports = async ({ getNamedAccounts, deployments, getChainId }) => {
46
const { deploy } = deployments;
57
const { deployer } = await getNamedAccounts();
8+
const chainId = await getChainId();
69

710
await deploy('Membership', {
811
from: deployer,
912
args: testArgs(),
1013
log: true,
1114
});
15+
16+
if (isLocalhost(chainId)) {
17+
const deps = {};
18+
await setupProof(deps);
19+
20+
if (process.env.TEST_STAGE === 'MINT_READY') {
21+
await membershipMintAndDelegate(await ethers.getContract('Membership'), deps);
22+
}
23+
}
1224
};
1325

1426
module.exports.tags = ['Membership'];

package.json

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -5,6 +5,8 @@
55
"main": "index.js",
66
"scripts": {
77
"start": "npx hardhat node --network hardhat --no-deploy",
8+
"dev": "npx hardhat node --export-all ../website/contracts/localhost.json",
9+
"dev:mint_ready": "TEST_STAGE=MINT_READY npx hardhat node --export-all ../website/contracts/localhost.json",
810
"test": "npx hardhat test --network hardhat",
911
"test:membership": "npx hardhat test --network hardhat tests/membership.js",
1012
"test:governor": "npx hardhat test --network hardhat tests/governor.js",

0 commit comments

Comments
 (0)