-
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
Showing
13 changed files
with
824 additions
and
50 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
node_modules | ||
package.json | ||
img | ||
artifacts | ||
cache | ||
coverage | ||
.env | ||
.* | ||
README.md | ||
coverage.json |
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,6 @@ | ||
{ | ||
"tabWidth": 4, | ||
"useTabs": false, | ||
"semi": false, | ||
"singleQuote": false | ||
} |
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,18 @@ | ||
|
||
Our Stablecoin Features | ||
|
||
1. (Relative Stability) Anchored or Pegged -> $1.00 | ||
1. Chainlink Price Feed. | ||
2. Set a function to exchnage ETH & BTC -> $$$. | ||
2. Stability Mechanism (Minting): Algorithmic (Decentralized) | ||
1. Can only mint the StbaleCoin with enough collateral. | ||
3. Collateral: Exogenous (Crypto) | ||
1. ETH ERC20 version wETH. | ||
2. BTC ERC20 version wBTC. | ||
|
||
|
||
-> Calculate Health Factor Function | ||
-> Set Health Factor if dept is 0 | ||
-> Added a bunch of view Function | ||
|
||
1. What are our invariants/properties? |
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 was deleted.
Oops, something went wrong.
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,33 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.18; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {DecentralizedStableCoin} from "../src/DecentralizedStableCoin.sol"; | ||
import {DSCEngine} from "../src/DSCEngine.sol"; | ||
import {HelperConfig} from "../script/HelperConfig.s.sol"; | ||
|
||
contract DeployDSC is Script { | ||
// function setUp() public {} | ||
|
||
address[] public tokenAddresses; | ||
address[] public priceFeedAddresses; | ||
|
||
function run() external returns (DecentralizedStableCoin, DSCEngine, HelperConfig) { | ||
HelperConfig config = new HelperConfig(); | ||
|
||
(address wethUsdPriceFeed, address wbtcUsdPriceFeed, address weth, address wbtc, uint256 depployerKey) = config.activeNetworkConfig(); | ||
|
||
tokenAddresses = [weth, wbtc]; | ||
priceFeedAddresses = [wethUsdPriceFeed, wbtcUsdPriceFeed]; | ||
|
||
vm.startBroadcast(depployerKey); | ||
DecentralizedStableCoin dsc = new DecentralizedStableCoin(); | ||
DSCEngine engine = new DSCEngine(tokenAddresses, priceFeedAddresses, address(dsc)); | ||
|
||
dsc.transferOwnership(address(engine)); | ||
|
||
vm.stopBroadcast(); | ||
|
||
return (dsc, engine, config); | ||
} | ||
} |
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,66 @@ | ||
// SPDX-License-Identifier: MIT | ||
pragma solidity ^0.8.18; | ||
|
||
import {Script} from "forge-std/Script.sol"; | ||
import {MockV3Aggregator} from "../test/mocks/MockV3Aggregator.sol"; | ||
import {ERC20Mock} from "@openzeppelin/contracts/mocks/ERC20Mock.sol"; | ||
|
||
contract HelperConfig is Script { | ||
struct NetworkConfig { | ||
address wethUsdPriceFeed; | ||
address wbtcUsdPriceFeed; | ||
address weth; | ||
address wbtc; | ||
uint256 deployerKey; | ||
} | ||
|
||
uint8 public constant DECIMALS = 8; | ||
int256 public constant ETH_USD_PRICE = 2000e8; | ||
int256 public constant BTC_USD_PRICE = 1000e8; | ||
uint256 public DEFAULT_ANVIL_KEY = 0xac0974bec39a17e36ba4a6b4d238ff944bacb478cbed5efcae784d7bf4f2ff80; | ||
|
||
NetworkConfig public activeNetworkConfig; | ||
|
||
constructor() { | ||
if (block.chainid == 11155111){ | ||
activeNetworkConfig = getSepoliaEthConfig(); | ||
} else { | ||
activeNetworkConfig = getOrCreateAnvilEthConfig(); | ||
} | ||
} | ||
|
||
function getSepoliaEthConfig() public view returns (NetworkConfig memory) { | ||
return NetworkConfig({ | ||
wethUsdPriceFeed: 0x694AA1769357215DE4FAC081bf1f309aDC325306, | ||
wbtcUsdPriceFeed: 0x1b44F3514812d835EB1BDB0acB33d3fA3351Ee43, | ||
weth: 0xdd13E55209Fd76AfE204dBda4007C227904f0a81, | ||
wbtc: 0x8f3Cf7ad23Cd3CaDbD9735AFf958023239c6A063, | ||
deployerKey: vm.envUint("PRIVATE_KEY") | ||
}); | ||
} | ||
|
||
function getOrCreateAnvilEthConfig() public returns (NetworkConfig memory) { | ||
if (activeNetworkConfig.wethUsdPriceFeed != address(0)) { | ||
return activeNetworkConfig; | ||
} | ||
|
||
vm.startBroadcast(); | ||
MockV3Aggregator ethUsdPriceFeed = new MockV3Aggregator(DECIMALS, ETH_USD_PRICE); | ||
|
||
ERC20Mock wethMock = new ERC20Mock("WETH", "WETH", msg.sender, 1000e8); | ||
|
||
MockV3Aggregator btcUsdPriceFeed = new MockV3Aggregator(DECIMALS, BTC_USD_PRICE); | ||
|
||
ERC20Mock wbtcMock = new ERC20Mock("WBTC", "WBTC", msg.sender, 1000e8); | ||
|
||
vm.stopBroadcast(); | ||
|
||
return NetworkConfig({ | ||
wethUsdPriceFeed: address(ethUsdPriceFeed), | ||
wbtcUsdPriceFeed: address(btcUsdPriceFeed), | ||
weth: address(wethMock), | ||
wbtc: address(wbtcMock), | ||
deployerKey: DEFAULT_ANVIL_KEY | ||
}); | ||
} | ||
} |
This file was deleted.
Oops, something went wrong.
Oops, something went wrong.