-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
1 parent
2746c69
commit 42d1dc0
Showing
2 changed files
with
49 additions
and
4 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,37 @@ | ||
// SPDX-License-Identifier: SEE LICENSE IN LICENSE | ||
pragma solidity ^0.8.18; | ||
|
||
import {Test} from "forge-std/Test.sol"; | ||
import {console} from "forge-std/console.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"; | ||
|
||
contract DSCEngineTest is Test { | ||
DeployDSC deployer; | ||
DecentralizedStableCoin dsc; | ||
DSCEngine engine; | ||
HelperConfig config; | ||
address ethUsdPriceFeed; | ||
address weth; | ||
|
||
function setUp() public { | ||
console.log("1"); | ||
deployer = new DeployDSC(); | ||
console.log("2"); | ||
(dsc, engine, config) = deployer.run(); | ||
console.log("3"); | ||
(ethUsdPriceFeed,, weth,,) = config.activeNetworkConfig(); | ||
} | ||
|
||
//Price Test | ||
|
||
function testGetUsdValue() public { | ||
uint256 ethAmount = 15e18; | ||
uint256 expectedUsd = 30000e18; | ||
uint256 actualUsd = engine.getUsdValue(weth, ethAmount); | ||
console.log(actualUsd); | ||
assertEq(expectedUsd, actualUsd); | ||
} | ||
} |