Skip to content
Discussion options

You must be logged in to vote

Actually position matters...
Follow the comments...

function testIfCollateralDepositedEventIsEmitted() public {
    vm.startPrank(USER);
    vm.expectEmit(true, true, true, false, address(dscEngine));    // Here, we expect an event to be emitted.
    emit CollateralDeposited(USER, weth, COLLATERAL_AMOUNT);     // Here, we emitted the desired event. You can consider it as an expected event to be emitted. However, it's still expecting `CollateralDeposited` to be emitted once a real transaction is performed. As you know, `vm.startPrank` ignores checks <-> cheats and considers only real transactions.

    // We perform the call
    ERC20Mock(weth).approve(address(dscEngine), COLLATERAL_AMOUNT…

Replies: 1 comment 5 replies

Comment options

You must be logged in to vote
5 replies
@alfheimrShiven
Comment options

@theirrationalone
Comment options

@PatrickAlphaC
Comment options

@theirrationalone
Comment options

@alfheimrShiven
Comment options

Answer selected by alfheimrShiven
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Category
Q&A
Labels
None yet
3 participants