Stablecoins are cryptocurrencies that are designed to have stable price.
- forge install openzeppelin/openzeppelin-contracts --no-commit
- forge install smartcontractkit/chainlink-brownie-contracts --no-commit
- Relative Stability: Anchored or Pegged -> $1.00
- Chainlink price feed
- Set a function to exchange ETH and BTC ->$$$
- Stability Mechanism (Minting): Algorithmic (Decentralized)
- People can only mint stablecoin with enough collateral
- Collateral: Exogenous (Crypto)
- wETH
- wBTC
Liquidator can cover debt of a user by burning their DSC debt, and get all their collateral in return.
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
- 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)
depositCollateral (address tokenCollateralAddress, uint256 amountCollateral)
- Deposits given amountCollateral of a tokenCollateralAddress to msg.sender's account. |