Skip to content

Meriem-BM/algorithmic-desc

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

29 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Overcollaterized Stablecoin

A Foundry implementation of an overcollateralized stablecoin protocol.

Users deposit approved collateral, mint DSC, burn DSC to reduce debt, redeem collateral, and liquidate unhealthy positions. Collateral values come from Chainlink price feeds.

Contracts

  • DeStablecoin.sol: ERC20 stablecoin token named DeStablecoin with symbol DSC. Minting and burning are restricted to the owner.
  • DSCEngine.sol: Core protocol engine for collateral deposits, DSC minting, redemptions, health factors, price valuation, and liquidations.

Protocol Rules

  • Collateral tokens and price feeds are configured at deployment.
  • Positions must remain overcollateralized.
  • The liquidation threshold is 50%, which requires 200% collateralization.
  • Liquidators receive a 10% collateral bonus.
  • Price feeds are rejected if the answer is non-positive, stale, or incomplete.

Quick Start

Install Foundry:

curl -L https://foundry.paradigm.xyz | bash
foundryup

Install submodules if needed:

git submodule update --init --recursive

Build and test:

forge build
forge test

Check formatting:

forge fmt --check

Deployment

Local Anvil deployment:

anvil
forge script script/DeployDSC.s.sol:DeployDSC --rpc-url http://127.0.0.1:8545 --broadcast

Sepolia deployment:

PRIVATE_KEY=<your_private_key> forge script script/DeployDSC.s.sol:DeployDSC --rpc-url <sepolia_rpc_url> --broadcast

Layout

src/      Core contracts
script/   Deployment and network configuration
test/     Unit tests and mocks
lib/      Foundry dependencies

About

Overcollateralized stablecoin implementation

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors