@@ -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+
7683module . exports . findEvent = async function ( fn , eventName ) {
7784 const tx = await fn ;
7885 const recipe = await tx . wait ( ) ;
0 commit comments