import hre from "hardhat" ; export async function setTime ( timestamp ) { return await hre . ethers . provider . send ( "evm_setNextBlockTimestamp" , [ timestamp , ] ) ; } export async function setTimeAndMineBlock ( timestamp ) { await setTime ( timestamp ) ; return await hre . ethers . provider . send ( "evm_mine" , [ ] ) ; } export async function mineInOrderInSameBlock ( txs ) { await deactiveAutomine ( ) ; for ( const tx of txs . slice ( 0 , - 1 ) ) { await tx ( ) ; } await activateAutomine ( ) ; await txs [ txs . length - 1 ] ( ) ; } export async function deactiveAutomine ( ) { await hre . network . provider . send ( "evm_setAutomine" , [ false ] ) ; } export async function activateAutomine ( ) { await hre . network . provider . send ( "evm_setAutomine" , [ true ] ) ; }