The Decentralized Stablecoin (DSC) Protocol is a secure, over-collateralized stablecoin system implemented on Ethereum. It enables users to deposit crypto assets as collateral and mint stablecoins pegged to USD. The protocol ensures that the total supply of stablecoins never exceeds the total value of collateral, providing stability and reliability.
- Mint Stablecoins: Users can mint stablecoins by locking up collateral in supported crypto assets.
- Redeem Collateral: Users can redeem their collateral by burning stablecoins.
- Over-Collateralization: Ensures that the protocol is always sufficiently collateralized.
- Invariant Testing: Validates critical properties of the system, such as ensuring that the protocol's collateral value always exceeds the total stablecoin supply.
- Fuzz Testing: Simulates edge cases to ensure robustness against unexpected inputs.
- DSCEngine: Core logic for handling collateral, minting, and redemption.
- DecentralisedStableCoin: The stablecoin token contract.
- Handler: Manages test scenarios for fuzz and invariant testing.
- Foundry
- Node.js
- An Ethereum-compatible wallet (e.g., MetaMask)
- Clone the repository:
git clone https://github.com/yourusername/dsc-protocol.git cd dsc-protocol - Install dependencies:
forge install
- Compile the contracts:
forge build
forge buildCompiles the smart contracts and generates ABI files.
forge testRuns all unit tests to ensure the correctness of the protocol.
forge test --fuzz-runnerTests the protocol under randomized conditions.
forge test --match-contract InvariantsEnsures that the protocol invariants hold during all operations.
forge test --gas-reportGenerates a detailed gas usage report for each function.
Contributions are welcome! If you find bugs or have ideas for improvements, please open an issue or submit a pull request.
This project is licensed under the MIT License.