potmarion / Blueberry-Lender

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Blueberry Bank

Blueberry Bank is a blockchain agnostic, decentralized peer to peer lending platform based on a fork of [Iron Bank] which is based on a fork Compound Finance.

Blueberry Bank bridges liquidity across underserved assets by providing algorithmic money markets to these underserved assets. Users can supply any supported assets and use these supplied assets as collateral to borrow any other supported assets. Iron Bank has launched on Ethereum, Fantom and Avalance.

Before getting started with this repo, please read the Compound protocol repo,

Installation

git clone https://github.com/ib/compound-protocol
cd compound-protocol
yarn install --lock-file # or `npm install`

Building

yarn compile

Testing

Jest contract tests are defined under the tests directory. To run the tests run:

yarn test

Change Logs

  • Add borrow cap feature, this feature is cherry picked from Compound Finance compound-finance/compound-protocol#65

    • Add a borrow cap check in Comptroller's borrowAllowed hook, disallow further borrowing if an market's totalBorrows reaches its borrow cap
  • Add supply cap feature, implemented in Comptroller.sol, BCapableErc20.sol

    • Add a supply cap check in Comptroller's mintAllowed hook, disallow further minting (supplying) if an market's cash + totalBorrows reaches its supply cap
    • BCapableErc20 tracks cash by itself instead of using balanceOf of underlying token. This avoids direct transfering to bToken to manipulate cash.
  • Add collateral cap feature, implemented in Comptroller.sol, BCollateralCapErc20.sol

    • Add a collateral cap to determine the maximum balance to be considered as collateral. If the cap is reached, users could still supply the asset but it can't be used as collateral.
    • The maximum borrow power of this kind of asset is roughly collateralCap * collateralFactor.
  • Add BWrappedNative to replace old BEther

    • BWrappedNative could support both the native token and the wrapped native token.
    • Users could choose the native token or the wrapped native token when supplying / borrowing / redeeming / repaying.
  • Support protocol to protocol borrowing without collateral, this gives whitelisted protocol borrows up to credit limit without collateral.

    • Add credit limit in Comptroller.sol
    • When setup a credit limit, it also needs to specify the borrow markets.
  • Support flashloan feature to offer a wide range of use cases, including democratized liquidations, arbitrage, collateral swapping and interest rate swapping.

    • Iron Bank flashloan complies EIP-3156 standard.
    • Not every market supports flashloan.

About


Languages

Language:Solidity 49.6%Language:TypeScript 26.2%Language:JavaScript 23.1%Language:PEG.js 0.4%Language:Shell 0.4%Language:Makefile 0.2%Language:Dockerfile 0.0%