Code Monkey home page Code Monkey logo

rex-bank's People

Contributors

bennisan86 avatar brendaloya avatar dependabot[bot] avatar josealonso avatar mikeghen avatar ngmachado avatar skuhlmann avatar themandalore avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

rex-bank's Issues

Track Total Debt Owed

There isn't currently a simple way to track how much was loaned out. This issue involves tracking these aggregate statistics somewhere in the contract and creating a getTotalDebtOwned()

Don't use msg.sender in view functions

Im not sure why I use msg.sender here but it makes it so that polygonscan UI doesn't let you read your amounts. I think I might have done this for privacy reasons. Its probably unnecessary
Screen Shot 2021-12-01 at 8 58 26 AM
Screen Shot 2021-12-01 at 8 57 23 AM

Delegated Keepers

There needs to be a way to delegate liquidation management to keepers. Project teams are fine providing liquidity but do not want to be responsible for managing liquidations. There needs to be an allow list for adding keepers and allowing them to call liquidate.

Convert to Hardhat & Tests

This task involves converting the project to a Hardhat project, including moving over the tests. Probably dependant on #23

Use `balanceOf()` instead of tracking the reserve amount

  • Right now we track a reserve amount (reserve.debtBalance) which requires all deposits to call reserveDeposit()
  • This issue is about replacing the internal reserve amount with calls to the balanceOf method

reserve.debtBalance += amount;

  • This accounting method leads to tokens transferred or anything else will be locked and unaccounted for in the contract

require(reserve.debtBalance >= amount, "NOT ENOUGH DEBT TOKENS IN RESERVE");

  • The above statement means anything not accounted for
  • transferred tokens, will NOT be withdrawable, because they're not properly accounted for in the contract
  • This is a pretty bad error in the contract since it can result in loss of funds
    • If tokens are ERC20 transferred into the contract, then they become locked forever
  • Need to support streaming in the USDCx into the bank contract
  • Need to get the debtBalance using the balanceOf method instead of tracking it in a variable within the contract, which is very prone to error
  • A good fix is to make a method to get the current debt available, call it debtBalance()
  • Sample debtBalance method:
fuction debtBalance() public view returns (uint256 balance) {
  return this.debtToken.balanceOf(address(this));
}
  • This is based on the premise that any tokens in the contract can be borrowed, which is true
  • Implement this as a method rather than putting this.debtToken.balanceOf(address(this)) all over the codebase
  • Given the above implementation of debtBalance(), all the references to reserve.debtBalance will be replaced with debtBalance()

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.