Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

In the written lesson error name is directly used without accessing it through contract object #329

Merged
merged 1 commit into from
Jan 27, 2025

Conversation

GunjanSurti
Copy link
Contributor

The change is in Advance Foundry section 3 Develop a Defi protocol - written lesson 13

https://updraft.cyfrin.io/courses/advanced-foundry/develop-defi-protocol/test-defi-protocol

function testRevertsIfCollateralZero() public {
    vm.startPrank(USER);
    ERC20Mock(weth).approve(address(dsce), AMOUNT_COLLATERAL);

 @> vm.expectRevert(DSCEngine__NeedsMoreThanZero.selector);
    dsce.depositCollateral(weth, 0);
    vm.stopPrank();
}

Fix:

The error name is directly called instead of calling from contract object.

Contractg object is added DSCEngine

function testRevertsIfCollateralZero() public {

 @> vm.expectRevert(DSCEngine.DSCEngine__NeedsMoreThanZero.selector);
   
}

Link to the issue:

#328

@EngrPips
Copy link
Contributor

Hello @GunjanSurti, Thanks for this contribution, and this will be attended to appropriately as soon as possible.

Copy link
Contributor

@Equious Equious left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for this submission 🙏

@Equious Equious merged commit c043e02 into Cyfrin:main Jan 27, 2025
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants