Git Product home page Git Product logo

foundry-security-defi's Introduction

Stablecoins

Stablecoins are cryptocurrencies that are designed to have stable price.

Libraries used

  1. forge install openzeppelin/openzeppelin-contracts --no-commit
  2. forge install smartcontractkit/chainlink-brownie-contracts --no-commit

Features

  1. Relative Stability: Anchored or Pegged -> $1.00
    1. Chainlink price feed
    2. Set a function to exchange ETH and BTC ->$$$
  2. Stability Mechanism (Minting): Algorithmic (Decentralized)
    1. People can only mint stablecoin with enough collateral
  3. Collateral: Exogenous (Crypto)
    1. wETH
    2. wBTC

Liquidate Feature note

Liquidator can cover debt of a user by burning their DSC debt, and get all their collateral in return.

Formal Verification

Act of proving or disproving a given property using a mathematical model. - Stateful fuzzing -> An advanced testing technique used to identify bugs in a system that maintain state across interactions, such as network protocols or interactive applications. Unlike traditional fuzzing, which treats system as a blackbox and throw random numbers at it, stateful fuzzing understands concept of different states and attempts to transition the system through different states in a meaningful way.

In other words, the ending state of the previous state is the starting state of next test as 
opposed to stateless fuzzing. So any changes to state variables are preserved/committed
for next test!

In foundry, stateful fuzzing == Invariant fuzzing
  1. What are invariants/properties? That way, we can write stateful and stateless tests.
Functions

depositCollateral (tokenCollateralAddress, amountCollateral)

mintDsc ( dscAmountToMint)

depositCollateralAndMintDsc (tokenCollateralAddress, amountCollateral, dscAmountToMint)

redeemCollateral (tokenCollateralAddress, amountCollateral)

redeemCollateralForDsc (tokenCollateralAddress, amountCollateral, dscAmountToBurn)

Function depositCollateral

depositCollateral (address tokenCollateralAddress, uint256 amountCollateral)

  • Deposits given amountCollateral of a tokenCollateralAddress to msg.sender's account. |

foundry-security-defi's People

Contributors

falsegenius avatar

Stargazers

 avatar

Watchers

 avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.