import { Contract , ContractTransaction , BigNumberish , Transaction } from 'ethers' ; import { expect } from 'chai' ; export const expectEvent = ( contract , eventName ) => async ( tx , ... args ) => { await expect ( Promise . resolve ( tx ) ) . to . emit ( contract , eventName ) . withArgs ( ... args ) ; } ; export const expectTransferEventOn = ( contract ) => async ( tx , from , to , amount ) => { await expectEvent ( contract , 'Transfer' ) ( tx , from , to , amount ) ; } ; export const expectBurnEventOn = ( contract ) => async ( tx , from , amount ) => { await expectEvent ( contract , 'Burn' ) ( tx , from , amount ) ; } ; export const expectMintEventOn = ( contract ) => async ( tx , to , amount ) => { await expectEvent ( contract , 'Mint' ) ( tx , to , amount ) ; } ; export const expectEventsCountOn = ( contract ) => async ( eventName , tx , count ) => { expect ( ( await tx . wait ( ) ) . events . filter ( ( { address , event } ) => address === contract . address && event === eventName ) . length ) . to . equal ( count ) ; } ;