Skip to content

Commit b587e8e

Browse files
committed
Add new helper util membershipMintAndDelegate()
1 parent 0b2bbe0 commit b587e8e

File tree

1 file changed

+19
-12
lines changed

1 file changed

+19
-12
lines changed

utils/helpers.js

Lines changed: 19 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -42,18 +42,7 @@ module.exports.contractsReady = function (context, instantMint = false) {
4242
const governor = Governor.attach(await membership.governor());
4343

4444
if (instantMint) {
45-
await membership.updateAllowlist(context.rootHash);
46-
await membership.setupGovernor();
47-
48-
// Do NOT use `context.allowlistAccounts.forEach` to avoid a block number change
49-
await Promise.all(
50-
context.allowlistAccounts.map((account, idx) => {
51-
return Promise.all([
52-
membership.connect(account).mint(context.proofs[idx]),
53-
membership.connect(account).delegate(context.allowlistAddresses[idx]),
54-
]);
55-
})
56-
);
45+
await membershipMintAndDelegate(membership, context);
5746
}
5847

5948
// Create a test merkle tree
@@ -73,6 +62,24 @@ module.exports.contractsReady = function (context, instantMint = false) {
7362
});
7463
};
7564

65+
module.exports.membershipMintAndDelegate = async function membershipMintAndDelegate(
66+
membership,
67+
context
68+
) {
69+
await membership.updateAllowlist(context.rootHash);
70+
await membership.setupGovernor();
71+
72+
// Do NOT use `context.allowlistAccounts.forEach` to avoid a block number change
73+
await Promise.all(
74+
context.allowlistAccounts.map((account, idx) => {
75+
return Promise.all([
76+
membership.connect(account).mint(context.proofs[idx]),
77+
membership.connect(account).delegate(context.allowlistAddresses[idx]),
78+
]);
79+
})
80+
);
81+
};
82+
7683
module.exports.findEvent = async function (fn, eventName) {
7784
const tx = await fn;
7885
const recipe = await tx.wait();

0 commit comments

Comments
 (0)