Skip to content

About

A decentralized stablecoin system built on Ethereum that enables users to mint stablecoins backed by crypto collateral. The protocol ensures over-collateralization, stability, and security through smart contracts and follows robust design principles. Includes invariant testing and fuzz testing for reliability.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Latest commit

 

History

4 Commits

Folders and files

Repository files navigation

Decentralized Stablecoin (DSC) Protocol

Overview

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.

Features

  • 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.

Smart Contracts

  • DSCEngine: Core logic for handling collateral, minting, and redemption.
  • DecentralisedStableCoin: The stablecoin token contract.
  • Handler: Manages test scenarios for fuzz and invariant testing.

Setup

Prerequisites

  • Foundry
  • Node.js
  • An Ethereum-compatible wallet (e.g., MetaMask)

Installation

  1. Clone the repository:
    git clone https://github.com/yourusername/dsc-protocol.git
    cd dsc-protocol
  2. Install dependencies:
    forge install
  3. Compile the contracts:
    forge build

Foundry Commands

Compilation

forge build

Compiles the smart contracts and generates ABI files.

Running Tests

Unit Tests

forge test

Runs all unit tests to ensure the correctness of the protocol.

Fuzz Testing

forge test --fuzz-runner

Tests the protocol under randomized conditions.

Invariant Testing

forge test --match-contract Invariants

Ensures that the protocol invariants hold during all operations.

Gas Report

forge test --gas-report

Generates a detailed gas usage report for each function.

Contributing

Contributions are welcome! If you find bugs or have ideas for improvements, please open an issue or submit a pull request.

License

This project is licensed under the MIT License.

About

A decentralized stablecoin system built on Ethereum that enables users to mint stablecoins backed by crypto collateral. The protocol ensures over-collateralization, stability, and security through smart contracts and follows robust design principles. Includes invariant testing and fuzz testing for reliability.

Resources

Stars

0 stars

Watchers

1 watching

Forks

Releases

Packages

Contributors

Languages