GithubHelp home page GithubHelp logo

collateralized-vault's Introduction

Collateralized Vault

yieldprotocol/mentorship2022#5

Objectives

Users can deposit an asset they own (collateral), to borrow a different asset that the contract owns (underlying). The exchange rate will be determined by an oracle, and if the value of the collateral drops in underlying terms, the user will be liquidated. We will use Wrapped Ether as the collateral, and DAI as the underlying. Pull the contract code for both from Etherscan, and add a mint() function that allows you to obtain as much as you need for testing.

  1. Users can deposit WETH in the Collateralized Vault. WETH is transfered from the user to the Vault, Vault records the amount of WETH the user has deposited.
  2. Users can borrow DAI against their WETH, as long as the value DAI they borrow in WETH terms is less than the value of their WETH collateral.
  3. When borrowing, the Collateral Vault sends DAI to the users. The contract owner supplies DAI to the contract on construction.
  4. Use a Chainlink Oracle to obtain ETH/DAI exchange rate
  5. Users can repay their debt with DAI.
  6. Users can withdraw their WETH collateral. If they have a debt, they can't withdraw WETH in a way that makes the value of their collateral drop below the value of their debt.
  7. To withdraw their Ether, the users must repay the DAI they borrowed.
  8. If the ETH/DAI price changes such that the value of the debt of an user is more than the value of their collateral, the contract owner can erase the user records from the contract, cancel the user debt, and stop that user from withdrawing their collateral.

Functions

deposit()

borrow()

repay()

withdraw()

liquidate()

getPrice()

collateralized-vault's People

Contributors

thryec avatar

Watchers

 avatar

Forkers

zeropointlabs

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.