-
Notifications
You must be signed in to change notification settings - Fork 1k
Replies: 1 comment · 5 replies
-
Hello @YavorJJ, Run those two tests that failed separately and run them with the |
Beta Was this translation helpful? Give feedback.
All reactions
-
Ran 1 test for test/unit/DSCEngine.t.sol:DSCEngineTest [159475] DSCEngineTest::testRevertsIfMintAmountBreaksHealthFactor() Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 4.01ms (291.54µs CPU time) Ran 1 test suite in 801.14ms (4.01ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) Failing tests: Encountered a total of 1 failing tests, 0 tests succeeded 2nd one: [⠆] Compiling... Ran 1 test for test/unit/DSCEngine.t.sol:DSCEngineTest [185307] DSCEngineTest::testRevertsIfMintedDscBreaksHealthFactor() Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 2.22ms (282.98µs CPU time) Ran 1 test suite in 794.55ms (2.22ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests) Failing tests: Encountered a total of 1 failing tests, 0 tests succeeded ' ' ' 1st is for testRevertsIfMintAmountBreaksHealthFactor |
Beta Was this translation helpful? Give feedback.
All reactions
-
Please put some effort into formatting properly so it will be easier for people to help you. |
Beta Was this translation helpful? Give feedback.
All reactions
-
testRevertsIfMintAmountBreaksHealthFactor function testRevertsIfMintAmountBreaksHealthFactor() public depositedCollateral {
// 0xe580cc6100000000000000000000000000000000000000000000000006f05b59d3b20000
// 0xe580cc6100000000000000000000000000000000000000000000003635c9adc5dea00000
(, int256 price,,,) = MockV3Aggregator(ethUsdPriceFeed).latestRoundData();
amountToMint = (amountCollateral * (uint256(price) * dsce.getAdditionalFeedPrecision())) / dsce.getPrecision();
vm.startPrank(USER);
uint256 expectedHealthFactor =
dsce.calculateHealthFactor(amountToMint, dsce.getUsdValue(weth, amountCollateral));
vm.expectRevert(abi.encodeWithSelector(DSCEngine.DSCEngine__BreaksHealthFactor.selector, expectedHealthFactor));
dsce.mintDsc(amountToMint);
vm.stopPrank();
} Ran 1 test for test/unit/DSCEngine.t.sol:DSCEngineTest
[FAIL. Reason: Error != expected error: 0x8b5c142b00000000000000000000000000000000000000000000000006f05b59d3b20000 != 0x6c1c366600000000000000000000000000000000000000000000000006f05b59d3b20000] testRevertsIfMintAmountBreaksHealthFactor() (gas: 186975)
Traces:
[10032592] DSCEngineTest::setUp()
├─ [4597863] → new @0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f
│ └─ ← [Return] 22852 bytes of code
├─ [5229130] 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f::run()
│ ├─ [3411454] → new @0x104fBc016F4bb334D775a19E8A6510109AC63E00
│ │ ├─ [0] VM::startBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [372255] → new @0x90193C961A926261B756D1E5bb255e67ff9498A1
│ │ │ └─ ← [Return] 1082 bytes of code
│ │ ├─ [516505] → new @0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496
│ │ │ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f, value: 100000000000 [1e11])
│ │ │ └─ ← [Return] 2117 bytes of code
│ │ ├─ [0] VM::stopBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [0] VM::startBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [372255] → new @0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3
│ │ │ └─ ← [Return] 1082 bytes of code
│ │ ├─ [516505] → new @0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76
│ │ │ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f, value: 100000000000 [1e11])
│ │ │ └─ ← [Return] 2117 bytes of code
│ │ ├─ [0] VM::stopBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [0] VM::envUint("DEFAULT_ANVIL_KEY") [staticcall]
│ │ │ └─ ← [Return]
│ │ └─ ← [Return] 6714 bytes of code
│ ├─ [912] 0x104fBc016F4bb334D775a19E8A6510109AC63E00::activeNetworkconfig() [staticcall]
│ │ └─ ← [Return] 0x90193C961A926261B756D1E5bb255e67ff9498A1, 0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3, 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76, 77814517325470205911140941194401928579557062014761831930645393041380819009408 [7.781e76]
│ ├─ [0] VM::startBroadcast()
│ │ └─ ← [Return]
│ ├─ [591455] → new @0x5FbDB2315678afecb367f032d93F642f64180aa3
│ │ ├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
│ │ └─ ← [Return] 2610 bytes of code
│ ├─ [985596] → new @0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
│ │ └─ ← [Return] 4245 bytes of code
│ ├─ [2424] 0x5FbDB2315678afecb367f032d93F642f64180aa3::transferOwnership(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512)
│ │ ├─ emit OwnershipTransferred(previousOwner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, newOwner: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512)
│ │ └─ ← [Stop]
│ ├─ [0] VM::stopBroadcast()
│ │ └─ ← [Return]
│ └─ ← [Return] 0x5FbDB2315678afecb367f032d93F642f64180aa3, 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, 0x104fBc016F4bb334D775a19E8A6510109AC63E00
├─ [912] 0x104fBc016F4bb334D775a19E8A6510109AC63E00::activeNetworkconfig() [staticcall]
│ └─ ← [Return] 0x90193C961A926261B756D1E5bb255e67ff9498A1, 0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3, 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76, 77814517325470205911140941194401928579557062014761831930645393041380819009408 [7.781e76]
├─ [24912] 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496::mint(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], 10000000000000000000 [1e19])
│ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], value: 10000000000000000000 [1e19])
│ └─ ← [Stop]
└─ ← [Stop]
[159475] DSCEngineTest::testRevertsIfMintAmountBreaksHealthFactor()
├─ [0] VM::startPrank(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D])
│ └─ ← [Return]
├─ [24739] 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496::approve(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, 10000000000000000000 [1e19])
│ ├─ emit Approval(owner: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], spender: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, value: 10000000000000000000 [1e19])
│ └─ ← [Return] true
├─ [63438] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::depositCollateral(0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 10000000000000000000 [1e19])
│ ├─ emit CollateralDeposited(user: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], token: 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, amount: 10000000000000000000 [1e19])
│ ├─ [30888] 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496::transferFrom(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, 10000000000000000000 [1e19])
│ │ ├─ emit Transfer(from: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], to: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, value: 10000000000000000000 [1e19])
│ │ └─ ← [Return] true
│ └─ ← [Stop]
├─ [0] VM::stopPrank()
│ └─ ← [Return]
├─ [8993] 0x90193C961A926261B756D1E5bb255e67ff9498A1::latestRoundData() [staticcall]
│ └─ ← [Return] 1, 200000000000 [2e11], 1, 1, 1
├─ [314] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::getPrecision() [staticcall]
│ └─ ← [Return] 1000000000000000000 [1e18]
├─ [292] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::getAdditionalFeedPrecision() [staticcall]
│ └─ ← [Return] 10000000000 [1e10]
├─ [0] VM::startPrank(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D])
│ └─ ← [Return]
├─ [2591] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::getUsdValue(0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 10000000000000000000 [1e19]) [staticcall]
│ ├─ [993] 0x90193C961A926261B756D1E5bb255e67ff9498A1::latestRoundData() [staticcall]
│ │ └─ ← [Return] 1, 200000000000 [2e11], 1, 1, 1
│ └─ ← [Return] 20000000000000000000000 [2e22]
├─ [719] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::calculateHealthFactor(20000000000000000000000 [2e22], 20000000000000000000000 [2e22]) [staticcall]
│ └─ ← [Return] 500000000000000000 [5e17]
├─ [0] VM::expectRevert(DSCEngine__BreaksHealthFactor())
│ └─ ← [Return]
├─ [52892] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::mintDsc(20000000000000000000000 [2e22])
│ ├─ [993] 0x90193C961A926261B756D1E5bb255e67ff9498A1::latestRoundData() [staticcall]
│ │ └─ ← [Return] 1, 200000000000 [2e11], 1, 1, 1
│ ├─ [8993] 0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3::latestRoundData() [staticcall]
│ │ └─ ← [Return] 1, 100000000000 [1e11], 1, 1, 1
│ └─ ← [Revert] DSCEngine_BreaksHealthFactor(500000000000000000 [5e17])
└─ ← [Revert] Error != expected error: 0x8b5c142b00000000000000000000000000000000000000000000000006f05b59d3b20000 != 0x6c1c366600000000000000000000000000000000000000000000000006f05b59d3b20000
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 4.01ms (291.54µs CPU time)
Ran 1 test suite in 801.14ms (4.01ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:
Encountered 1 failing test in test/unit/DSCEngine.t.sol:DSCEngineTest
[FAIL. Reason: Error != expected error: 0x8b5c142b00000000000000000000000000000000000000000000000006f05b59d3b20000 != 0x6c1c366600000000000000000000000000000000000000000000000006f05b59d3b20000] testRevertsIfMintAmountBreaksHealthFactor() (gas: 186975)
Encountered a total of 1 failing tests, 0 tests succeeded
yavorjr@DESKTOP-BFAHRIB:~/foundry-defi-stablecoin-f23$ |
Beta Was this translation helpful? Give feedback.
All reactions
-
testRevertsIfMintedDscBreaksHealthFactor function testRevertsIfMintedDscBreaksHealthFactor() public {
(, int256 price,,,) = MockV3Aggregator(ethUsdPriceFeed).latestRoundData();
amountToMint = (amountCollateral * (uint256(price) * dsce.getAdditionalFeedPrecision())) / dsce.getPrecision();
vm.startPrank(USER);
ERC20Mock(weth).approve(address(dsce), amountCollateral);
uint256 expectedHealthFactor =
dsce.calculateHealthFactor(dsce.getUsdValue(weth, amountCollateral), amountToMint);
vm.expectRevert(abi.encodeWithSelector(DSCEngine.DSCEngine__BreaksHealthFactor.selector));
dsce.depositCollateralAndMintDsc(weth, amountCollateral, amountToMint);
vm.stopPrank();
} [⠆] Compiling...
No files changed, compilation skipped
Ran 1 test for test/unit/DSCEngine.t.sol:DSCEngineTest
[FAIL. Reason: Error != expected error: 0x8b5c142b00000000000000000000000000000000000000000000000006f05b59d3b20000 != l6f] testRevertsIfMintedDscBreaksHealthFactor() (gas: 185307)
Traces:
[10032592] DSCEngineTest::setUp()
├─ [4597863] → new @0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f
│ └─ ← [Return] 22852 bytes of code
├─ [5229130] 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f::run()
│ ├─ [3411454] → new @0x104fBc016F4bb334D775a19E8A6510109AC63E00
│ │ ├─ [0] VM::startBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [372255] → new @0x90193C961A926261B756D1E5bb255e67ff9498A1
│ │ │ └─ ← [Return] 1082 bytes of code
│ │ ├─ [516505] → new @0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496
│ │ │ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f, value: 100000000000 [1e11])
│ │ │ └─ ← [Return] 2117 bytes of code
│ │ ├─ [0] VM::stopBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [0] VM::startBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [372255] → new @0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3
│ │ │ └─ ← [Return] 1082 bytes of code
│ │ ├─ [516505] → new @0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76
│ │ │ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: 0x5615dEB798BB3E4dFa0139dFa1b3D433Cc23b72f, value: 100000000000 [1e11])
│ │ │ └─ ← [Return] 2117 bytes of code
│ │ ├─ [0] VM::stopBroadcast()
│ │ │ └─ ← [Return]
│ │ ├─ [0] VM::envUint("DEFAULT_ANVIL_KEY") [staticcall]
│ │ │ └─ ← [Return]
│ │ └─ ← [Return] 6714 bytes of code
│ ├─ [912] 0x104fBc016F4bb334D775a19E8A6510109AC63E00::activeNetworkconfig() [staticcall]
│ │ └─ ← [Return] 0x90193C961A926261B756D1E5bb255e67ff9498A1, 0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3, 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76, 77814517325470205911140941194401928579557062014761831930645393041380819009408 [7.781e76]
│ ├─ [0] VM::startBroadcast()
│ │ └─ ← [Return]
│ ├─ [591455] → new @0x5FbDB2315678afecb367f032d93F642f64180aa3
│ │ ├─ emit OwnershipTransferred(previousOwner: 0x0000000000000000000000000000000000000000, newOwner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266)
│ │ └─ ← [Return] 2610 bytes of code
│ ├─ [985596] → new @0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512
│ │ └─ ← [Return] 4245 bytes of code
│ ├─ [2424] 0x5FbDB2315678afecb367f032d93F642f64180aa3::transferOwnership(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512)
│ │ ├─ emit OwnershipTransferred(previousOwner: 0xf39Fd6e51aad88F6F4ce6aB8827279cffFb92266, newOwner: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512)
│ │ └─ ← [Stop]
│ ├─ [0] VM::stopBroadcast()
│ │ └─ ← [Return]
│ └─ ← [Return] 0x5FbDB2315678afecb367f032d93F642f64180aa3, 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, 0x104fBc016F4bb334D775a19E8A6510109AC63E00
├─ [912] 0x104fBc016F4bb334D775a19E8A6510109AC63E00::activeNetworkconfig() [staticcall]
│ └─ ← [Return] 0x90193C961A926261B756D1E5bb255e67ff9498A1, 0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3, 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 0xDB8cFf278adCCF9E9b5da745B44E754fC4EE3C76, 77814517325470205911140941194401928579557062014761831930645393041380819009408 [7.781e76]
├─ [24912] 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496::mint(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], 10000000000000000000 [1e19])
│ ├─ emit Transfer(from: 0x0000000000000000000000000000000000000000, to: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], value: 10000000000000000000 [1e19])
│ └─ ← [Stop]
└─ ← [Stop]
[185307] DSCEngineTest::testRevertsIfMintedDscBreaksHealthFactor()
├─ [8993] 0x90193C961A926261B756D1E5bb255e67ff9498A1::latestRoundData() [staticcall]
│ └─ ← [Return] 1, 200000000000 [2e11], 1, 1, 1
├─ [314] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::getPrecision() [staticcall]
│ └─ ← [Return] 1000000000000000000 [1e18]
├─ [292] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::getAdditionalFeedPrecision() [staticcall]
│ └─ ← [Return] 10000000000 [1e10]
├─ [0] VM::startPrank(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D])
│ └─ ← [Return]
├─ [24739] 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496::approve(0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, 10000000000000000000 [1e19])
│ ├─ emit Approval(owner: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], spender: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, value: 10000000000000000000 [1e19])
│ └─ ← [Return] true
├─ [4591] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::getUsdValue(0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 10000000000000000000 [1e19]) [staticcall]
│ ├─ [993] 0x90193C961A926261B756D1E5bb255e67ff9498A1::latestRoundData() [staticcall]
│ │ └─ ← [Return] 1, 200000000000 [2e11], 1, 1, 1
│ └─ ← [Return] 20000000000000000000000 [2e22]
├─ [719] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::calculateHealthFactor(20000000000000000000000 [2e22], 20000000000000000000000 [2e22]) [staticcall]
│ └─ ← [Return] 500000000000000000 [5e17]
├─ [0] VM::expectRevert(DSCEngine__BreaksHealthFactor())
│ └─ ← [Return]
├─ [114164] 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512::depositCollateralAndMintDsc(0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, 10000000000000000000 [1e19], 20000000000000000000000 [2e22])
│ ├─ emit CollateralDeposited(user: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], token: 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496, amount: 10000000000000000000 [1e19])
│ ├─ [30888] 0xA8452Ec99ce0C64f20701dB7dD3abDb607c00496::transferFrom(user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, 10000000000000000000 [1e19])
│ │ ├─ emit Transfer(from: user: [0x6CA6d1e2D5347Bfab1d91e883F1915560e09129D], to: 0xe7f1725E7734CE288F8367e1Bb143E90bb3F0512, value: 10000000000000000000 [1e19])
│ │ └─ ← [Return] true
│ ├─ [993] 0x90193C961A926261B756D1E5bb255e67ff9498A1::latestRoundData() [staticcall]
│ │ └─ ← [Return] 1, 200000000000 [2e11], 1, 1, 1
│ ├─ [8993] 0xBb2180ebd78ce97360503434eD37fcf4a1Df61c3::latestRoundData() [staticcall]
│ │ └─ ← [Return] 1, 100000000000 [1e11], 1, 1, 1
│ └─ ← [Revert] DSCEngine_BreaksHealthFactor(500000000000000000 [5e17])
└─ ← [Revert] Error != expected error: 0x8b5c142b00000000000000000000000000000000000000000000000006f05b59d3b20000 != l6f
Suite result: FAILED. 0 passed; 1 failed; 0 skipped; finished in 2.22ms (282.98µs CPU time)
Ran 1 test suite in 794.55ms (2.22ms CPU time): 0 tests passed, 1 failed, 0 skipped (1 total tests)
Failing tests:
Encountered 1 failing test in test/unit/DSCEngine.t.sol:DSCEngineTest
[FAIL. Reason: Error != expected error: 0x8b5c142b00000000000000000000000000000000000000000000000006f05b59d3b20000 != l6f] testRevertsIfMintedDscBreaksHealthFactor() (gas: 185307)
Encountered a total of 1 failing tests, 0 tests succeeded
|
Beta Was this translation helpful? Give feedback.
All reactions
-
Hey @YavorJJ, If it is difficult to get the |
Beta Was this translation helpful? Give feedback.
-
Hello, two of my tests have been failing, and whatever I do and check it is not fixing.
here are my code files:
solidity
' ' '
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
}
solidity
' ' '
this is the test dscengine:
// SPDX-License-Identifier: MIT
pragma solidity ^0.8.19;
import {Test} from "forge-std/Test.sol";
import {DeployDSC} from "../../script/DeployDSC.s.sol";
import {DecentralizedStableCoin} from "../../src/DecentralizedStableCoin.sol";
import {DSCEngine} from "../../src/DSCEngine.sol";
import {HelperConfig} from "../../script/HelperConfig.s.sol";
import {ERC20Mock} from "@openzeppelin/contracts/mocks/token/ERC20Mock.sol";
import { MockV3Aggregator } from "../mocks/MockV3Aggregator.sol";
import { Test, console } from "forge-std/Test.sol";
import { StdCheats } from "forge-std/StdCheats.sol";
contract DSCEngineTest is Test {
DeployDSC deployer;
DecentralizedStableCoin dsc;
DSCEngine dsce;
HelperConfig config;
address ethUsdPriceFeed;
address weth;
address btcUsdPriceFeed;
}
}
when I type forge test these two functions are creating problems, and I am stuck on them for almost a day: testRevertsIfMintAmountBreaksHealthFactor and testRevertsIfMintedDscBreaksHealthFactor.
here is what the terminal gives me:
![image](https://private-user-images.githubusercontent.com/171678195/347841784-6a6cf6fd-18ee-475a-a200-9f72c203c8b9.png?jwt=eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJpc3MiOiJnaXRodWIuY29tIiwiYXVkIjoicmF3LmdpdGh1YnVzZXJjb250ZW50LmNvbSIsImtleSI6ImtleTUiLCJleHAiOjE3MzkwODg5MjMsIm5iZiI6MTczOTA4ODYyMywicGF0aCI6Ii8xNzE2NzgxOTUvMzQ3ODQxNzg0LTZhNmNmNmZkLTE4ZWUtNDc1YS1hMjAwLTlmNzJjMjAzYzhiOS5wbmc_WC1BbXotQWxnb3JpdGhtPUFXUzQtSE1BQy1TSEEyNTYmWC1BbXotQ3JlZGVudGlhbD1BS0lBVkNPRFlMU0E1M1BRSzRaQSUyRjIwMjUwMjA5JTJGdXMtZWFzdC0xJTJGczMlMkZhd3M0X3JlcXVlc3QmWC1BbXotRGF0ZT0yMDI1MDIwOVQwODEwMjNaJlgtQW16LUV4cGlyZXM9MzAwJlgtQW16LVNpZ25hdHVyZT1kMWMwNDJhYWMxNWRhZDQ2NDZmMjgyYmRkNTcwNDM1NGZiYzlkOWRmODdhNzg2M2NlNjdhYTI4M2U1ZDk1ZGQzJlgtQW16LVNpZ25lZEhlYWRlcnM9aG9zdCJ9.si-QHf0NoQOOtZ8kEphUJue9QHk2Al3GGNTerFylM6k)
' ' '
Love to hear from all you, any feedback can be helpful :)
Beta Was this translation helpful? Give feedback.
All reactions