Giter VIP home page Giter VIP logo

protocol's Introduction

Babylon Finance

Community-led Asset Management. Powered by DeFi.

CI

Quick Start

Git clone

git clone https://github.com/babylon-finance/protocol.git

Install dependencies

yarn

Compile contracts

yarn compile

Development

โ›ฝ๏ธ Gas Report

yarn gas-report

๐Ÿ›ก Coverae

yarn coverage

๐Ÿค– Prettier

yarn prettier

๐Ÿ’ช Solhint

yarn lint:contracts

๐Ÿ“ Contract Size

yarn estimate-size

๐Ÿงช Test

To run unit tests

yarn test:unit

To run integartion tests

yarn test:integration

To run fast integration tests (recommended)

yarn test:integration:fast

Or watch test ๐Ÿ‘

yarn test:watch

Deploy

To deploy SCs you need to have .env file configured for the selected network, e.g., mainnet. The file should have the following entries.

  ALCHEMY_KEY=XXXXXXXX
  DEPLOYER_PRIVATE_KEY=XXXXXXXX
  OWNER_PRIVATE_KEY=XXXXXXXX
  BLOCKNATIVE_API_KEY=XXXXXXXX
  ETHERSCAN_KEY=XXXXXXXX
  DEFENDER_API_KEY=XXXXXXXX
  DEFENDER_API_SECRET=XXXXXXXX

For non-upgradeable contracts use named scripts from the deployments/migrations/ folder, e.g., 040-univ2-trade.js would deploy UniswapV2TradeIntegration. To invoke the script use the following command.

  npx hardhat deploy --network mainnet --tags UniV2Trade

tags value can be found inside a deployment script.

To deploy a new implementation for an upgradeable contract use deploy-contract.js script, e.g., to deploy a new implementation for the Strategy contract use the following command:

  npx hardhat deploy-contract --contract StrategyV16 --network mainnet

contract is the name of the new implementation.

To auto-deploy a contract use a simple bash script which will try until it succeeds.

  while ! npx hardhat deploy-contract --contract StrategyV16 --network mainnet; do echo 'Trying to deploy
  again ๐Ÿค–'; done; echo 'Deployed ๐Ÿš€';

deploy-contract command supports passing arguments to the contract constructor. You can use deployments names instead of the addresses. This feature requires using the dx{contractName} notation, e.g.:

  npx hardhat deploy-contract --contract BabylonViewer --network mainnet dxBabControllerProxy
  npx hardhat deploy-contract --contract AddLiquidityOperation --network mainnet lp dxBabControllerProxy

Upgrade

To upgrade Babylon Protocol use upgrade-multisig.js script. It will create a batch tx for Gnosis Multisig to upgrade all the proxies in the protocol. The command bellow upgrades BabController, RewardsDistributor, Strategy, and Garden to the appropriate implementations. The implementations have to be deployed beforehand using deploy-contrat script.

  npx hardhat upgrade-multisig --network mainnet --controller BabControllerV11 --distributor RewardsDistributorV11 --strategy StrategyV14 --garden GardenV15

All the arguments are optional meaning only required proxies should be upgraded.

The list of options for upgrade is the following:

  • controller
  • distributor
  • garden
  • assistant
  • strategy
  • curve
  • oracle
  • buy
  • liquidity
  • deposit
  • lend
  • tradeCurve
  • tradeUniV3
  • tradeSynth
  • tradeUniV2

An example of the command:

npx hardhat upgrade-multisig --network mainnet --curve CurveMetaRegistry --oracle PriceOracle --trade-curve CurveTradeIntegration --liquidity AddLiquidityOperation

This script will create a proposal at Defender Admin. It has to be signed and executed to upgrade the protocol.

scripts

Fuse

npx hardhat fuse --network mainnet

Gets Fuse positions stats of Heart and Heart garden.

AAVE

npx hardhat aave 0x371b23eedb1a5e3822aacff906187111a91fae88 --network mainnet

Gets Aave positions stats of provided accounts. Many accounts can be provided at once.

protocol's People

Contributors

dependabot[bot] avatar rrecuero avatar rriescog avatar undfined avatar ylv-io avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar

protocol's Issues

General test coverage

  • Add Fixture for beforeEach in FolioController
  • Add coverage to FolioController
  • Add coverage to ClosedFund

UI v0.1

  • Include DAPIS style guide
  • List available HedgeFunds (invest, show position, withdraw, stats)
  • Fund detail page
  • Look into fund metrics (frontend side)
    Standard deviation
    Value at Risk
    Skewness
    Kurtosis

Performance
Absolute returns
Relative Returns
Sharpe Ratio
Sortino Ratio
Beta
Correlation
Alpha

  • Store secondary details in JSON file IPFS

Sample Tweet

Hi there. I am working on a DeFi protocol focused on asset management. Ran an MVP for 3 months with a small test fund and a limited number of investors. The returns were 80% vs ETH and 1100% vs USD (both annualized).

We are trying to get feedback and mechanics before we release our beta in the next two months.

A bit about me, I previously worked for YCombinator, Google, Zynga as a maker and led product at OpenZeppelin.

If you are interested, we would love to tell you more about this idea.

Reach out email template

Hi _,

Thank you for your time. As I mentioned on Twitter, I have been working on a Defi project.

Here are some details:

We want to give medium to long term investors an easy hands-off way to create a portfolio that captures the investment opportunity of the decade. The goal is to create a multi-sided ecosystem that attracts the best active managers and pairs them with investors that share their risk, liquidity, and time preferences.

Ran an MVP for 3 months with a small test fund and a limited number of investors. (~50ETH).
The returns were 80% vs ETH and 1100% vs USD (both annualized).

I am sharing with you our draft slide deck. We are gathering as much feedback as we can, we would love to chat with you about the tokenomics and the different incentives of the participants in the protocol.

Here are the slides. Any feedback would be appreciated.

If you have the time to discuss it further, let me know a few times that work for you, and I'll send you an invite.

Thanks again for your time!

Ramon

Calculate Risk Metrics

Add benchmark asset somewhere (ETH)

  • Standard deviation
  • Value at Risk
  • Skewness
  • Kurtosis

Create fundraising slides

750K
Perverse incentives hell -> Charlie Munger Quote

"If the internet turned the world into publishers, crypto will turn the world into investors"

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.