Doubts in the Project Decentralzied Stable Coin concept #2626
-
I have 100's of questions regarding the liquidity but I would like to ask this first, maybe this answer my another questions. So I have doubt regarding the main concept of liquidity in DSCEngine So you can see the Scenario Here is the code of my test of liquidity function testForLiquidityPass() public {
//setup
vm.startPrank(USER);
ERC20Mock(weth).approve(address(engine), 1 ether);
engine.depositCollateralAndMintDSC(weth, 1 ether, 1000 ether);
int256 updateAnswer = 1500e8;
MockV3Aggregator(ethUsdPriceFeed).updateAnswer(updateAnswer);
// uint256 userHealthFactor = engine.getHealthFactor(USER);
vm.stopPrank();
vm.startPrank(liquidator);
ERC20Mock(weth).approve(address(engine), 2 ether);
engine.depositCollateralAndMintDSC(weth, 2 ether, 1000 ether);
dsc.approve(address(engine), 1000 ether);
(uint256 userBeforeLiquidityDSC, uint256 userBeforeLiquidity)= engine.getAccountInformation(USER);
(uint256 liquidatorBeforeLiquidityDSC, uint256 liquidatorBeforeLiquidity)= engine.getAccountInformation(liquidator);
consolesBefore(userBeforeLiquidityDSC, userBeforeLiquidity, liquidatorBeforeLiquidityDSC, liquidatorBeforeLiquidity);
//liquidate
engine.liquidate(weth, USER, 1000e18);
//Effects
(uint256 userAfterLiquidityDSC, uint256 userAfterLiquidity)= engine.getAccountInformation(USER);
(uint256 liquidatorAfterLiquidityDSC, uint256 liquidatorAfterLiquidity)= engine.getAccountInformation(liquidator);
consolesAfter(userAfterLiquidityDSC, userAfterLiquidity, liquidatorAfterLiquidityDSC, liquidatorAfterLiquidity);
vm.stopPrank();
} So according to this Scenario as per above. The question arise is Why someone lock their $2000 just to get $1100 ?? Here is my repo link if anyone want to check additional detail: Thank you for responding and your precious time. 🙏 |
Beta Was this translation helpful? Give feedback.
Replies: 1 comment 3 replies
-
Hello @farman1094, The codebase is far from being a production codebase, and honestly, many things weren't considered in the codebase. So I will say understand the concept of what the codebase teaches, and you can work to improve anything you think isn't properly implemented. |
Beta Was this translation helpful? Give feedback.
Hello @farman1094, The codebase is far from being a production codebase, and honestly, many things weren't considered in the codebase. So I will say understand the concept of what the codebase teaches, and you can work to improve anything you think isn't properly implemented.