# Introduction

Welcome to Babylon! This page provides an introduction to the protocol.

![](/files/-MYXB5FNvN-EAoLGV-_v)

Welcome to Babylon! Babylon is a community-led asset management protocol that enables users to invest in DeFi together. It's built on the Ethereum network and it's non-custodial, transparent, permission-less, and governed by the community.

Babylon has a two-layer governance system. The protocol is managed by the holders of the governance token, $BABL, which is used to vote on changes to the protocol and decide on the best use of the protocol treasury.&#x20;

Babylonians can create investment communities (called "Gardens") and invite people to deposit capital. Members participate in the garden by joining the telegram chat, suggesting investment Strategies and voting on Strategies. Members receive rewards based on their contributions to the protocol.

You can read our introductory announcement [here](https://medium.com/babylon-finance/introducing-babylon-finance-8199fa89f918).


# Terminology

This page explains the common terms used in Babylon.

* **Babylon.finance -** Community-led asset management protoco&#x6C;**.**  Create gardens and invest in DeFi together.
* **Gardens** - Investment communities in Babylon. Garden members can deposit capital, suggest Strategies, vote on Strategies, and earn rewards.
* **$BABL** - ERC-20 governance token that controls the protocol parameters and treasury. The majority of $BABL is reserved for community distributions.
* **Prophets** - 2592 NFTs that provide utility within Babylon Finance. The prophets were distributed during the [arrival event](/prophets/the-prophets-arrival-concluded#c02c).
* **Garden Token** - ERC-20 tokens that represents a member's ownership in a Garden. Members receive Garden Tokens in exchange for depositing capital into a Garden.
* **Integration** - DeFi protocol that Babylon integrates with.
* **Strategy** - An investment that contains one or multiple DeFi operations along with parameters like expected return and duration. e.g lending, borrowing, adding liquidity...
* **Candidate Strategy** - Strategy that has been submitted but has not received enough votes to be activated yet.
* **Active Strategy** - Strategy that received Garden capital and deployed it to different DeFi protocols.
* **Completed Strategy** - Strategy that completed its DeFi operations and has returned capital to the Garden.
* **Strategist** - Garden member who submits a Strategy.
* **Voter** - Garden member who votes on a Strategy.
* **Member** - Anyone who deposits capital into a Garden.
* **Garden Creator** - Anyone who creates a Garden.


# User Guides

Use our easy-to-follow guides to walk you through all things Babylon Finance.

{% hint style="success" %}
**Guide Summary**

1. Funding a Web3 Wallet:
2. Joining a Garden:
3. Creating a Garden:
4. Growing Your Garden:
   {% endhint %}

### Step-by-step Guide to joining a Garden:

Crypto Natives are welcome to skip around to what is most relevant for you.&#x20;

{% content-ref url="/pages/9fkXgsOYKg5bgjaAg5oN" %}
[1. Funding a Web3 Wallet:](/getting-started/user-guides/1.-funding-a-web3-wallet)
{% endcontent-ref %}

{% content-ref url="/pages/QQbhpY1ZHBOY8wBo86na" %}
[2. Joining a Garden:](/getting-started/user-guides/2.-joining-a-garden)
{% endcontent-ref %}

{% content-ref url="/pages/R8tbz5Vm40nWj7dNf1GA" %}
[3. Creating a Garden:](/getting-started/user-guides/3.-creating-a-garden)
{% endcontent-ref %}

{% content-ref url="/pages/IZ5KaVrSTRyerP6aHMtN" %}
[4. Growing Your Garden:](/getting-started/user-guides/4.-growing-your-garden)
{% endcontent-ref %}

{% content-ref url="/pages/BdQi8AAo1rKqo54Wyy8d" %}
[5. Buying BABL Tokens:](/getting-started/user-guides/5.-buying-babl-tokens)
{% endcontent-ref %}

{% content-ref url="/pages/ftHtn83D0OVJyNXcskAP" %}
[6. Staking BABL Tokens:](/getting-started/user-guides/6.-staking-babl-tokens)
{% endcontent-ref %}

{% content-ref url="/pages/hAynoPAE6YB5DrF26M3I" %}
[7. Bonding ETH/BABL:](/getting-started/user-guides/7.-bonding-eth-babl)
{% endcontent-ref %}

{% hint style="info" %}
**Good to know:** Feel free to reach out anytime[ in Discord](https://discord.com/invite/babylon) for personal support.
{% endhint %}


# 1. Funding a Web3 Wallet:

First Steps

Babylon Finance is a decentralized application (Dapp) running on top of the Ethereum blockchain. Sometimes we call these Dapps "Web3" and you will need a Web3 wallet to interact with them.&#x20;

**Step 1:** Download Metamask from Metamask.io

![](/files/rrRHsWfEkY1DCmc7Jq5R)

**Step 2:** Closely follow Metamask's instructions to safely set up, secure, and backup your private key phrase.&#x20;

{% hint style="danger" %}
Reminder: Never input your seed phrase into anything. A legitimate Web3 protocol will never ask you for your seed phrase. Never give your seed phrase to someone else.
{% endhint %}

**Step 3:** Use your preferred fiat on-ramp exchange to fund your new Web3 wallet with Ether (ETH). You will need ETH in your wallet to pay for your transactions.

**Step 4:** Acquire the reserve currency to want your investments to be denominated in. If you want to invest stablecoins like USDC or USDT you will need to acquire it from an exchange.

Popular Crypto Exchanges:&#x20;

* <https://www.coinbase.com/> - Centralized
* <https://www.kraken.com/> - Centralized&#x20;
* <https://www.binance.com/en> - Centralized&#x20;
* <https://ftx.com/> - Centralized&#x20;
* <https://uniswap.org/> - Decentralized
* <https://www.sushi.com/> - Decentralized&#x20;


# 2. Joining a Garden:

Learn how to join a garden on Babylon

Once you have a Web3 wallet installed on your browser you can start exploring different gardens.&#x20;

**Step 1:** When you get to the landing page of Babylon Finance you will need to launch the application with the button at the top right of the page.&#x20;

![Step 1](/files/vVmD5tVjmQJZgohRyDsS)

**Step 2:** After launching the application, press the same button again, which this time prompts you to connect your wallet.&#x20;

![Step 2](/files/P7e5mbWeHSP5R86oiKSx)

**Step 3:** Select Metamask and a pop-up will prompt you to select an account you want to connect to Babylon with. Select the account you funded in [User Guide 1. Funding a Web3 Wallet.](/getting-started/user-guides/1.-funding-a-web3-wallet)&#x20;

![Step 3](/files/XS13Lut57cBHw97r2nI3)

**Step 4:** Search for the garden you want to join. In our example we will be joining The Fountain of ETH which will be right on the front page, but don't forget to check out [the Leaderboard](https://www.babylon.finance/leaderboard) to see Babylon's top performing gardens.

![Step 4](/files/FMHVG6tKHcPkLMgDT2Oz)

**Step 5:** Take a moment to explore the garden parameters, strategies, charts, metrics, and everything else to ensure its risk profile is in line with your risk appetite before pressing the Deposit to Join button.&#x20;

![Step 5](/files/G7vPSG4W5kP3uqVsmEkc)

**Step 6:** A deposit pop-up will appear and the first thing you'll notice is Babylon uses [Signature Deposits](https://docs.babylon.finance/getting-started/faq#what-is-a-signature-based-transaction) to reduce gas costs for its users. In our example, we have a Web3 wallet funded with ETH, but the reserve currency for The Fountain of ETH is actually WETH, or Wrapped Ether. Thankfully Babylon makes it easy to purchase (or wrap) any reserve currency supported by the platform. Click the link to "Buy WETH."&#x20;

![Step 6](/files/jENORDRP2mTWouSTOCBo)

**Step 7:** Upon clicking the link to "Buy WETH" a new page will open on your browser taking you to [Matcha.xyz](https://matcha.xyz/), a decentralized exchange aggregator. Matcha will allow you to convert (or wrap) ETH to WETH at a 1:1 ratio. Enter your desired deposit amount into the "You Pay" field, click "Review Order," and follow the same Metamask prompts from Step 3 to connect your wallet.

![Step 7](/files/l5iISlijOWPpUWoraEeH)

Step 8: After connecting your wallet and reviewing the conversion rate, press "Place Order" and a metamask pop-up will appear asking you to confirm your order. Keep in mind gas prices and review your transaction a final time before pressing "Confirm."&#x20;

![Step 8](/files/U7c15PLzn8R2qktvfcHC)

**Step 9:** You can click "View Transaction" to be taken to Etherscan.io where you can check on the progress of your order; otherwise, simply wait until Matcha confirms your transaction was a "Success!," and head back over to The Fountain of ETH Deposit page on Babylon.

![Step 9](/files/lQEKIiZr5w4cWahN57f8)

**Step 10:** After returning to the deposit page, take a moment to review and agree to the [Terms and Conditions](https://www.babylon.finance/terms), as well as the acknowledgment related to risk. Babylon is non-custodial and does not have access to your funds; however, it will need your permission to deposit funds into a garden. After reviewing the terms and risks, enter your desired deposit amount and click "Approve WETH Allowance."

![Step 10](/files/BgE2M1bdMf2v0CdBh8DX)

**Step 11:** Approve the transaction in metamask, and wait for it to be confirmed.

![Step 11](/files/W6INNiweJRAJeBr9Yt3b)

![Step 11](/files/Ya8TlbHyokSuZHMaTsF1)

**Step 12:** When you return to the deposit page, you may be prompted to refresh because the gas price you were quoted before approving WETH on Babylon is now out of date. Press Refresh and then select "Deposit by Signature" to continue.

![Step 12](/files/n8xQNuSXRQVqkDDPfuoe)

**Step 13:** When you press the deposit button, another metamask pop-up will appear, this time asking for your signature. This operation will not cost you any gas, and will deposit your WETH into the Fountain of ETH. Press the "Sign" button to approve the request and wait for the success prompt from Babylon.&#x20;

![Step 13](/files/Un7zvIamxYvv6xHGPhC2)

**Step 14:** That's it! You're done! You've successfully joined your first garden on Babylon Finance! The only thing left to do is engage with your garden community by clicking the "Garden Chat" link at the top of the page to be taken to your gardens private Discord channel.

![Step 14](/files/4kLiwMHaa3lCn3PqoVLX)

**Wrapping Up:** When you enter the Discord community you will be able to discuss strategies and market conditions with your fellow investment club members in order to make the best decisions for the garden.&#x20;

Leverage the wisdom of your community and help each other build wealth and invest in DeFi together! We look forward to seeing you [in Discord](https://discord.com/invite/babylon). Welcome to Babylon!


# 3. Creating a Garden:

Learn how to create a garden on Babylon

Once you have a Web3 wallet installed on your browser you can start exploring different gardens. If none of the existing gardens appeal to you, you are free to create your own. This guide will help you navigate the Dapp and get started building your own investment club with Babylon.

**Step 1:** When you hit the landing page of Babylon you will need to launch the application with the button at the top right of the page.&#x20;

![Step 1](/files/vVmD5tVjmQJZgohRyDsS)

**Step 2:** After launching the application, press the same button again, which this time prompts you to connect your wallet.&#x20;

![Step 2](/files/P7e5mbWeHSP5R86oiKSx)

**Step 3:** Select Metamask and a pop-up will prompt you to select an account you want to connect to Babylon with. Select the account you funded in [User Guide 1. Funding a Web3 Wallet.](/getting-started/user-guides/1.-funding-a-web3-wallet)&#x20;

![Step 3](/files/XS13Lut57cBHw97r2nI3)

**Step 4:** Go to the "Explore" tab at the top, or scroll to the bottom of the page to find the "Create your own" button.

![Step 4](/files/8VR75HvaoXGgxCpbLa4I)

**Step 5:** Closely review the highlighted features gardens offer to their creators and members, then click the "Begin Setup" button.&#x20;

![Step 5](/files/Xl9FSTPu2QBeufUNMrLn)

**Step 6:** Customize your garden name, reserve asset, description/thesis & the starting vanity NFT to represent your garden and click "Next." In our example we will use WETH as our reserve asset.

![Step 6](/files/GI5eTS3oqmAoGxHpp5BE)

**Step 7:** On the "Deposits & Redemptions" page you will be able to customize how assets are deposited or redeemed within the fund. Most of these parameters are safeties in place to avoid share price manipulation. When you are ready, click "Next."

{% hint style="info" %}
HINT: Be sure to hover over the (?) you see if you want more information about a specific parameter or setting.
{% endhint %}

![Step 7](/files/UMjPLj7KuOBGxdW5Wsba)

**Step 8:** On the "Access Control" page you can customize how profits are divided as well as determine who can join, vote, or propose strategies in your garden. We will continue using default parameters, but feel free to adjust these to your specific needs. Click "Next" when you are finished.&#x20;

![Step 8](/files/RZHNAGqL4T26rdr8cWx2)

**Step 9:** The "Capital & Duration" page will go over strategy parameters including minimum and maximum strategy durations, votes required to implement strategies, and risk preferences related to liquidity. When you are satisfied with your parameters, click "Next."

![Step 9](/files/ofOltdvXeFHLNOy8D8ls)

**Step 10:** Carefully review all of your parameters and settings. When you are satisfied, read and agree to the Terms and Conditions and press the "Approval Required" button at the bottom of the page.

{% hint style="info" %}
Babylon is non-custodial and does not have access to your funds; however, it will need your permission to deposit funds into a garden. If you only have ETH in your Web3 wallet, check out [Steps 6-9 in "User Guides: 2. Joining a Garden"](/getting-started/user-guides/2.-joining-a-garden) or simply [follow this link to Matcha.xyz](https://matcha.xyz/markets/1/0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2/0xeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeeee) where you can wrap your ETH into WETH.&#x20;
{% endhint %}

![Step 10](/files/AehPDZulL8f1AK7TYZSo)

**Step 11:** After pressing the approval button, a metamask pop-up will appear asking if you want to give babylon.finance permission to spend your WETH. This is required in order to deposit into gardens as well as create new ones. Confirm the transaction in Metamask and wait for it to be confirmed by the blockchain.

![Step 11](/files/WLhaOvNyqEgWweid1Wkm)

![Step 11](/files/kBiQiUcfcsZevtIDGeDy)

**Step 12:** Now that you have given Babylon permission to create your garden, all that's left is to press the Create a Garden button! Follow the Metamask prompts and wait for your transaction to be confirmed, and viola! You're garden is ready for your community.&#x20;

![Step 12](/files/rqkSU39uJ7E2TQE0t0jI)

**Wrapping Up:** Now that you've created your garden, hop into [our Discord ](https://discord.com/invite/babylon)and share your creation with the community in the #garden-pitches channel. Furthermore, please reach out to an admin to have a private Discord channel set up for your garden to serve as a gathering place to discuss strategies within your community. \
\
Leverage the wisdom of your community and help each other build wealth and invest in DeFi together! We look forward to seeing you in Discord. Welcome to Babylon!


# 4. Growing Your Garden:

“Wealth, like a tree, grows from a tiny seed."

Now that you are invested in a community garden, it's time to leverage your strengths as a community to grow your wealth together. If you have created your own garden, hop into [our Discord ](https://discord.com/invite/babylon)and share your creation with the community in the #garden-pitches channel.

Babylon was designed with an investment club mentality in mind, meaning all users can (and are incentivized to) participate in the decision making process. In Babylon, a minimum of 1% of the profits created through a strategy are shared with those who voted on that particular strategy. In addition to this, a strategist can earn up to 14% of the profit share for proposing and deploying profitable strategies.&#x20;

{% hint style="info" %}
Strategists will stake garden tokens when proposing a strategy, representing their conviction in it's ability to generate profits for voters. Voters who downvote strategies that still get implemented will earn a % of the strategists stake if the strategy lost money when it finalized.&#x20;
{% endhint %}

{% hint style="info" %}
Strategists in Babylon pay for the gas fees to deploy strategies. It's important that their incentives are aligned to generate profits for their garden members at the expense of their time and ETH fees.
{% endhint %}

[Join our Discord](https://discord.com/invite/babylon) and get involved, we're excited to see what kind of unique DeFi strategies you can come up with to grow your wealth together!


# 5. Buying BABL Tokens:

Learn how to buy BABL tokens on Uniswap

**Step 1:** Start on the <https://www.babylon.finance/> landing page.

**Step 2:** Click the BABL token price at the top of the page.

![Step 2](/files/CIN7nqR7SQWmidt5Quvl)

**Step 3:** You will be redirected to the Uniswap info page for BABL. Here you can see BABL liquidity, pools, swap history, volume, etc. Click the Trade button to be redirected to Uniswap's dapp.

![Step 3](/files/M8sm3a2jDzFDoJkebsmC)

**Step 4:** When you arrive at Uniswap, you will notice it auto fills the "Swap From" field with BABL. We want to press the arrow button in the middle of the UI to change this to "Swap To," since we are trying to buy BABL with another currency like ETH.

![Step 4](/files/YIz71lEhL2uyDEDvMQ7k)

**Step 5:** Now you need to select the token you wish to "Swap From" into BABL. In this example, we are going to be buying BABL with ETH. When you press the "Select a token" button, ETH will show up as the first item on the list.

![Step 5](/files/q065gY2VpXFs73XuLfhM)

**Step 6:** Now you can input how many BABL tokens you would like to buy, or you can input how many Ether tokens you wish to sell/trade for BABL. For our example, we will be buying 30 BABL.

![Step 6](/files/ZO0HjA55qkjWsqaMt1CR)

**Step 7:** When you press the Swap button, you will get a Metamask pop-up asking you to confirm that the swap information is correct. Check to make sure the gas estimation and the total transaction costs are in line with your expectations from Step 6, and press Confirm. If you have a hardware wallet, follow the prompts on your machine to confirm the transaction.&#x20;

![Step 7](/files/8GYG4bU5fxJE070Kd0aB)

**Step 8:** Wait for your transaction to be confirmed. You will notice a small Uniswap pop-up informing you if your swap was successful or not. One of the reasons it may return unsuccessful is if the price of BABL changed since the time you placed your order and the time it was processed. If you get a confirmation like the one below, your swap was a success!&#x20;

![Step 8](/files/rRpoxEu7oKgtPjybUlhm)

Check out the next user guide to learn how to stake your BABL tokens and participate in revenue sharing with the platform.&#x20;


# 6. Staking BABL Tokens:

Learn how to stake BABL tokens in the Heart of Babylon

**Step 1:** Start on the <https://www.babylon.finance/> landing page.

**Step 2:** Click the "Heart" link at the top of the page.

![Step 2](/files/TOCeCjtpNKJT2YHbouoC)

**Step 3:** On the Heart of Babylon page, click the Stake button to begin.

![Step 3](/files/b82415IGXR2rU5CsOU8f)

**Step 4:** Enter the amount of BABL tokens you wish to stake, read and acknowledge the Terms and Conditions as well as the risks, and click "Deposit by signature."

![Step 4](/files/U7ju45xcXOJxGjpPj9Za)

**Step 5:** Confirm the Metamask pop-up by signing the deposit message. If you have a hardware wallet, follow the prompts on your machine to confirm the signature.

![Step 5](/files/3QP9G8nWJ4ahC6BGuYYO)

**Step 6:** That's it! You've successfully deposited BABL tokens into the Heart of Babylon. You can monitor your position on the heart page or you can go to <https://www.babylon.finance/portfolio> and see everything in one place. Don't forget to vote, gas free, for your favorite garden to benefit from the Heart fee distributions and any BIP's that have been proposed.&#x20;


# 7. Bonding ETH/BABL:

Learn how to bond ETH/BABL LP tokens for a 5% discount in the Heart of Babylon

**Step 1:** Start on the <https://www.babylon.finance/> landing page.

**Step 2:** Click the "Heart" link at the top of the page.

![Step 2](/files/TOCeCjtpNKJT2YHbouoC)

**Step 3:** On the Heart of Babylon page, click the Bond button on the banner at the top of the page.

![Step 3](/files/g8bVvblQjcUeqtMEVYYy)

**Step 4:** Click BABL-ETH pair.

![Step 4](/files/yIUBz15hGAdfR2hAOOyK)

**Step 5:** On this pop-up you will click "Need BABL-ETH?" to be taken to [gamma.xyz](https://www.gamma.xyz/). Babylon's active liquidity management partner.&#x20;

![Step 5](/files/9XJIyf7vLvjn3r4JxOiG)

**Step 6:** On Gamma's landing page, connect your wallet by pressing the button on the top right of the page and then click "Provide Active Liquidity"&#x20;

![Step 6 ](/files/labIhnR0yWXD3E1ryiNb)

**Step 7:** On the Gamma Dashboard, find and select the ETH-BABL LP pair in the list.

![Step 7](/files/qpoLaocvoxxFaCyHBpDo)

**Step 8:** With ETH-BABL pair selected, a new banner will appear near the top of the list. Click on "Get LP Tokens" to continue.&#x20;

![Step 8](/files/8wUs2nM669lerKEYBBuz)

**Step 9:** An alert will pop-up, select "Get LP Tokens" again to continue.&#x20;

![Step 9](/files/Mgl2zBOlDRAgQMmGzHJj)

**Step 10:** Enter the amount of BABL tokens you wish to add as LP and the equivalent amount of ETH you need will auto populate for you. Check that these values are in line with your expectations and understanding of the BABL price, then click "Next."

![Step 10](/files/viD9EQp1mZVmrVZcRvdz)

**Step 11:** You will need to give Gamma permissions to spend your WETH to add BABL-ETH to liquidity. Click "Approve WETH" and follow the Metamask prompts.

![Step 11](/files/iJq03IzIKiAa9s5AKUFS)

![Step 11](/files/NV0V5d49O0vKKJTINo5f)

**Step 12:** After approving WETH for spending on Gamma, you will need to do the same for BABL. Click "Next," then "Approve BABL," and follow the Metamask prompts like before.

![Step 12](/files/UolU8W6lRBVRnM8K5qtS)

**Step 13:** With WETH & BABL approved, you are ready to add liquidity to Gamma, which will add liquidity to Uniswap V3. Click "Next," then "Deposit," then confirm the action in Metamask once again.

![Step 13](/files/5fs9J5kA2rMR7AlmuMRi)

**Step 14:** If your transactions succeeds, you will get an alert from Gamma informing you that you have successfully deposited WETH & BABL tokens into liquidity, and received Gamma LP tokens in return. You will use these Gamma LP tokens to bond them to the heart for a 5% discount on your deposit. You can head back to the Heart of Babylon page, or simply click "Go to Babylon" on the alert pop-up to be taken there.

![Step 14](/files/zO3OvAIlArURkBUcPhWB)

**Step 15:** There is one last token approval required in order to bond LP tokens. You will need to give Babylon permission to deposit your Gamma LP tokens into the Heart of Babylon. Back on the Bonding page from Step 5, you will see how much hBABL you will receive for your Gamma LP tokens. Confirm these values are in line with your expectations and click "Approve BABL-ETH Allowance" to continue.&#x20;

![Step 15](/files/4rm16dEbbvZFGziFWJCT)

**Step 16:** Follow the Metamask prompts and wait for confirmation. After your transaction succeeds, close the pop-up.

![Step 16](/files/bUQ0JFtdBKTtc2RZrZJF)

**Step 17:** You may notice a prompt telling you that the gas price is outdated. Press this button to refresh gas prices then select "Bond BABL-ETH by signature" and sign the transaction through Metamask.

![Step 17](/files/iOlhErN2N0gN5GflUdBq)

![Step 17](/files/s27pOjJNzUgfsQ304sGz)

**Step 18:** Now you just need to wait for Babylon to process your gasless signature deposit and you're done! You've successfully sold liquidity to Babylon for a discount on yield bearing BABL governance tokens, hBABL. You can monitor your position on the heart page or you can go to <https://www.babylon.finance/portfolio> and see everything in one place. Don't forget to vote, gas free, for your favorite garden to benefit from the Heart fee distributions and any BIP's that have been proposed.&#x20;


# Video Guides

Here are several guides to help you get started in Babylon:

1. [What's a Babylon Garden?](https://www.youtube.com/watch?v=xEDvGE8aBxM)
2. [What's BABL?](https://www.youtube.com/watch?v=7dGRp915Q8M)
3. [How to deposit assets into a garden](/getting-started/video-guides/deposit-into-a-garden)
4. [How to propose a strategy](/getting-started/video-guides/creating-a-strategy)


# Deposit into a Garden

1. Pick a **garden that matches your investment criteria** :palm\_tree:
2. Click on the **deposit** button on the top right&#x20;
3. Select the **amount** you want to deposit. Must meet garden min deposit requirement.
4. Verify the terms and conditions
5. Double-check the gas fee and the tx type between standard and signature-based.
   1. **Signature based-deposits** will probably be cheaper
   2. Some garden may even subsidize the cost to make it **free**.
6. Submit the deposit by clicking on the deposit button at the bottom

&#x20;Bonus: Remember to join the telegram channel to become a part of the community after depositing.&#x20;

{% embed url="<https://www.youtube.com/watch?v=IZ5CQaP0JDQ>" %}


# Creating a strategy

1\. Select the garden :palm\_tree:

2\. Click on strategies&#x20;

3\. If you have permissions, a submit new tab will appear. Click on it.&#x20;

4\. Click on create strategy button&#x20;

5\. Select Name

&#x20;6\. Select DeFi operations (in this case add liquidity to the tricrypto curve pool)&#x20;

7\. Select returns and duration (remember that as a strategist you can always close it before it ends but not beyond)&#x20;

8\. Select the amount of capital it would receive from the garden&#x20;

9\. Submit :rocket:

As a strategist, you would receive up to **10% of the profits** (varies per garden) + **10% BABL rewards.** More details in the [Mining Program](/babl/mining).

{% embed url="<https://www.youtube.com/watch?v=9jSLQJsHcUI>" %}


# FAQ

This page answers common questions about Babylon.

1. [General Questions](/getting-started/faq#general)
2. [$BABL Tokenomics](/getting-started/faq#usdbabl-tokenomics)
3. [Mining Program](/getting-started/faq#mining-program)
4. [Gardens](/getting-started/faq#gardens)
5. [Deposits & Withdrawals](/getting-started/faq#deposits-and-withdrawals)
6. [Strategies](/getting-started/faq#strategies)
7. [Voting](/getting-started/faq#voting)

## General

### What is Babylon.finance?

Babylon is a community-led asset management protocol that enables users to invest in DeFi together. It's built on the Ethereum network and it's non-custodial, transparent, permissionless, and governed by the community.

### When is Babylon.finance going to launch?

The alpha with team and investors started in May, 2021.

Settlers Beta started in July, 2021 and will continue until Dec 2021.&#x20;

Public launch will happen on January 2022.

### Is there going to be a public sale?

There are no plans for a public sale.&#x20;

69% of $BABL is reserved for community rewards.

### What's the Babylon team's responsibility?

The Babylon team is responsible for developing the protocol and handing governance to the community.&#x20;

With vesting over the next 4 years, the Babylon team's compensation is directly tied to protocol performance, aligning incentives to support users.

### Who is on the team?

The Babylon team includes seasoned entrepreneurs and technologists who have worked at companies like Y Combinator, OpenZeppelin, Google, Zynga, Allen Institute, and Telefonica.

You can read more about the team [here](https://www.linkedin.com/company/babylonfinance/people).

### How can I provide feedback & contact the team?

The best way to contact the team is to send a message in [Discord](https://discord.gg/eGatHr2a5u).

For more information about Babylon, please read our [introductory blog post](https://medium.com/babylon-finance/introducing-babylon-finance-8199fa89f918).

## $BABL Tokenomics

### What's the purpose of $BABL?

$BABL is the governance token for Babylon. $BABL holders will be able to vote on proposals through on-chain and off-chain governance.

### What's the total supply of $BABL?

1 million tokens

### What's the $BABL distribution?

* 69% reserved for community
* 19% investors
* 10% team
* 2% reserve

### How I can get $BABL?

$BABL is now listed on Uniswap V3 since November 28th 2021.

You can [purchase BABL here](https://app.uniswap.org/#/swap?inputCurrency=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\&outputCurrency=0xf4dc48d260c93ad6a96c5ce563e70ca578987c74).

The community also voted to start the **Mining Rewards program**. It started on October 17th 2021.

For more information, please read our [blog post about $BABL.](https://medium.com/babylon-finance/announcing-babl-8f41b58c52c5)

## Participation Rewards Program

### What's the purpose of the Participation Rewards Program?

The purpose of the Participation Rewards Program is to distribute $BABL to users based on their participation and the value they add to the protocol.

### How much $BABL is allocated to the program?

We proposed that the Rewards Program distribute 50% of the total token supply, 500K of $BABL, over the next 10 years.

### When does the program start?

October 17th 2021.&#x20;

All participants in the protocol that deposit into Gardens that have active strategies will be eligible to earn rewards.

### How long will the program last?

The supply curve is designed to optimize for the long-term sustainability of the protocol. The rewards are front-loaded but they last for more than 10 years, slowly decreasing every quarter.

### How are rewards distributed?

To align the incentives of all the active participants, we only plan to reward participants involved in active Strategies. Active Strategies are Strategies that have received enough votes to acquire capital from the Garden.

| Stakeholder    | Value Provided          | Rewards                                |
| -------------- | ----------------------- | -------------------------------------- |
| Member         | Capital, Garden signal. | 80% $BABL Rewards                      |
| Strategist     | Strategy submission     | 10% Profit Rewards + 10% $BABL Rewards |
| Voter          | Voting on Strategies    | 5% Profit Rewards + 10% $BABL Rewards  |
| Garden Creator | Garden creation         | 1.10x $BABL Rewards Bonus              |

For more information, please visit the Participation Rewards Program section in the [Litepaper](/babl/mining) and read our blog post about the [Participation Rewards Program](https://medium.com/babylon-finance/babl-mining-program-4829c313268d).

## Gardens

### What's a Garden?

A Garden is an investment community in Babylon. Babylonians can create a Garden and invite people to deposit capital, propose investment Strategies, vote, and earn rewards.

### Who can create a Garden?

During Beta, only Babylonians who receive an invite will be able to create a Garden. After Beta, anyone will be able to create a Garden.&#x20;

### What is the Garden Creator responsible for?

The Garden Creator is responsible for creating and growing their Garden. They define the Garden parameters, whitelist addresses that can join, and assign permissions to members.

After creating a Garden, the Creator doesn't have any special privileges except for receiving a 10% $BABL bonus on top of the $BABL rewards that he/she receives as part of the Participation Rewards Program.

### Are Garden publics or Private?

Gardens can be public or private and Garden Creators can adjust permissions for depositing, voting, and submitting investment Strategies.&#x20;

A Garden could be completely private by allowing only whitelisted addresses to deposit or it could be completely public by allowing anyone to deposit, suggest investment Strategies, and vote. Gardens can also adjust individual permissions, for example, by allowing anyone to deposit capital but only allowing certain members to suggest investment Strategies and/or vote.

### **What parameters can a Gardener set when creating a Garden?**

* **Garden Name**
* **Garden Description** - The Garden thesis and anything else members will want to know
* **Reserve Asset** - The asset that is used for deposits and withdrawals. Strategies consolidate into this asset upon completion and it's used as a performance benchmark.
* **Garden NFT** - Gardens receive an NFT that evolves as the Garden grows.
* **Minimum Member Deposit** - The minimum amount of capital a user needs to deposit to become a Garden member.
* **Maximum Garden Deposits** - The Maximum amount that can be deposited into a Garden by all members.
* **Deposit Hardlock** - The number of seconds a member has to wait after depositing to withdraw. Flash loan prevention.
* **Limit who can join Garden** - Makes Garden private or public.
* **Early Withdrawal Penalty** - Penalty for withdrawing capital from active Strategies.
* **Minimum Strategy Duration** - Minimum number of days a Strategy must be active.
* **Maximum Strategy Duration** - Maximum number of days a Strategy must be active.
* **% Quorum to Activate Strategy** - % of total votes needed to activate a Strategy.
* **# Voters to Reach Quorum** - # of people who have to vote to activate a Strategy.
* **Strategy Cooldown Period** - Hours to wait before activating a Strategy after quorum has been reached.&#x20;
* **Only assets above this liquidity** - Minimum liquidity of assets the Garden can invest in.

### **What reserve assets are available?**

Currently we support WETH and DAI. We plan to add more reserve assets in the future.

### Can a multisig create a Garden?

Yes. You can also create a Garden with a single multisig member to use Babylon for treasury management.

### **Can a Garden Creator whitelist members?**

If the Garden is private, the Garden Creator will need to whitelist and invite members to join. The Creator can also set and manage member permissions. Anyone can join public Gardens.

### Can a Garden change parameters after the Garden is created?

Currently, Gardens can't be changed after creation. This is done to protect users and to prevent them from having to constantly keep an eye on changes.

### How will Gardens upgrade as the protocol upgrades?

Gardens will automatically be upgraded as the protocol upgrades. We will announce any major changes ahead of time so that Gardens are aware of potential changes.

### **Can a whale take over a Garden by depositing more than everyone else?**

It is worth noting that only invited members can access private Gardens. For public Gardens, if the Garden Creator wants broad participation he/she can set a maximum deposit per member, quorum, and # Voters needed to activate a strategy to mitigate this risk.

### What happens if a Strategist or Garden Creator leaves a Garden?

A Garden Creator can leave at any time if the Garden is public. If the Garden is private, the Creator will need to transfer the control of the permissions whitelist to another member.

A Strategist with tokens staked on an active Strategy will not be able to withdraw the staked tokens until the Strategy completes. However, because they are the Strategist, they can unilaterally complete the Strategy whenever they like, and then withdraw.

### How are gas costs handled?

In Babylon, Gardens are designed to socialize gas costs across all the members. The more members there are in a Garden, the cheaper the costs for everyone. It is worth noting that we use OpenZeppelin relayers to ensure that the transactions are mined at a low gas price.

It's important that Garden Creators and Strategists have skin in the game. They need to pay these fixed costs in order to earn the right to earn bonuses and rewards. Their rewards are also tied to the overall performance of the Garden.

The team is working to optimize the cost of depositing and withdrawing from Gardens to be as cheap as possible. In some instances these actions may be done via signature to reduce costs.&#x20;

**Voting on Strategies is always done off-chain via signatures to make it free for users**.

## Deposits & Withdrawals

### **What is a signature (gasless) based transaction?**

In some cases Babylon uses signature based transactions to **greatly reduce gas costs for users**.&#x20;

1. The user signs a transaction object using MetaMask that includes properties like "minAmountOut" and "maxFee" that are then included in the on-chain transaction.&#x20;
2. This signature is then used by a "Keeper" to execute the transaction on behalf of the user.&#x20;

In this case. the user will pay the transaction fee from the principal of the transaction; ie: in case of a deposit the fee is subtracted from the reserve asset to be deposited.&#x20;

All of our transaction UI components that support signatures include details around the "Max Fee" to be paid but the final cost will often be less.&#x20;

To review details about a signature transaction we suggest using [Etherscan](https://etherscan.io/) by searching for your wallet address and reviewing transactions under “**Erc20 Token Txns**”.

### **How do we calculate Garden ownership when Members deposit capital?**

When a Member deposits capital into the Garden, they receive ERC-20 Garden Tokens that represent their % ownership. The number of Garden Tokens received depends on the current NAV of the Garden and the amount of capital deposited.

### How do we calculate NAV of a Garden?&#x20;

NAV of a Garden is calculated by assessing the current value of all the active assets through [Uniswap V3 Oracles.](https://docs.uniswap.org/protocol/reference/core/libraries/Oracle)&#x20;

### **How does withdrawing work? Can I withdraw at any time?**

Everyone in Babylon has the power to withdraw at any time, however in some instances withdrawing may require ending a Strategy and/or paying a penalty.

There are several scenarios:

* If you want to withdraw and there is enough liquidity in the Garden to withdraw the amount you request, you can withdraw at no penalty.
* If you want to withdraw and there isn't enough capital to withdraw (i.e. it's all tied up in active Strategies) you have two options:
  * Wait until the Strategy ends. At that point, you will be able to withdraw a pro-rata amount of the capital returned by the Strategy at no penalty.
  * Rage quit (withdraw immediately) and pay a 2.5% penalty. The penalty goes to the Garden (i.e. to remaining members) to compensate for the cost of partially liquidating active Strategies.
* If you are a Strategist and you stake Garden Tokens on an active Strategy, you can't withdraw those Garden Tokens until they are unstaked. As the Strategist, you always have the option to end the Strategy early if you want to withdraw.
* When you withdraw, **you give up all the BABL from active strategies**. Strategies only receive BABL once they finalize, so if you leave before that, the pending BABL will disappear.

### What happens if I lose access to my wallet?

Unfortunately, we cannot assist you if you lose access to your wallet. The protocol and website are non-custodial and we never hold your private keys.

### **How will performance and reputation be measured?**

Every Garden will have a member's table with a leaderboard based on the $BABL rewards obtained and other metrics. We have plans to add global leaderboards for Gardens, Strategists, and Voters in the future.

## Strategies

### **What protocols are you integrating with?**

You can find a list of all the [integrations here](/protocol/integrations).

### **What operations are supported?**

Lending, borrowing, buying ERC-20s, providing liquidity, staking, and yield farming.

### Can a Garden send capital to a private wallet?

A Garden can only send capital to a private wallet when a member withdraws from a Garden. In the same way, a Garden can only receive capital when a member deposits into the Garden in exchange for Garden Tokens. All Strategies are managed by the protocol and integrations.

### Can a Garden invest in a coin that benefits only a few people?

It's up to the Strategist and Stewards to decide which assets to buy. However, the protocol verifies that all assets available in Babylon have minimum liquidity in Uniswap to avoid 'exit' scams. Minimum liquidity is set during Garden creation.

### **How does exiting positions work? What if market conditions change?**

Once a Strategy duration elapses, a keeper will automatically complete the Strategy and consolidate the Strategy assets into the Garden's reserve asset. A Strategist can terminate their Strategy at any time if market conditions change.

### Will investments get front-run?

In order to minimize front-running risks the protocol does two things:

* Investments are executed by keepers in small chunks of capital.
* Fuzziness around the exact timing that a keeper will enter/exit positions.

## Voting

### **How will voting work?**

Any member of a Garden that has permission to vote will be able to vote on any candidate Strategy with the full weight of their Garden Tokens.&#x20;

Members can vote for or against a Strategy. Votes are not locked, meaning that if you use all of your Garden Tokens to vote on Strategy A, you can also use all of your Garden Tokens to vote on Strategy B. Voting is done using signatures, making it free.

You can find a detailed explanation of the [voting mechanics in the litepaper](/protocol/litepaper#voting-mechanics).

### Can I change my vote afterward?

At the moment, you can not change your vote, so please vote carefully.

### **What happens if market conditions change during a vote?**

A Strategist can delete their Strategy during voting for any reason.

### **How long will voting last for a Strategy?**

A Strategy can remain in the candidate state for a maximum of 7 days. At that point, if the Strategy has not achieved quorum, it will be deleted automatically.&#x20;

If a Strategy reaches quorum, it will enter the first cooldown period. The length of the cooldown period is different for each Garden and is set during Garden creation. During the first cooldown period, members who haven't voted for the Strategy can still do so.

If quorum is still met at the end of the first cooldown period, the Strategy will enter a second cooldown period of equal length and no members can vote during this period. Following the second cooldown period the Strategy will be executed by the Keeper.

### Can I delegate my votes?

Vote delegation is not currently possible. However, it may be enabled in the future.

### **Can votes be weighted by performance?**

This is one of the potential improvements we are considering in the future.


# Supported Software and Devices

This page describes the software and devices Babylon currently supports.

We support the following software:&#x20;

* Device: Desktop & Mobile.
* OS: MacOS (we don't currently support Windows)
* Browser: Google Chrome, Firefox, Safari and Brave (current versions)
* Wallet: Metamask, Wallet Connect, Trezor, and, Ledger (through Metamask). We also support many Mobile wallets through Wallet Connect including Rainbow, Trust and Argent.

Other software and devices may function, but we do not recommend using them at this time. We will add support for more software and devices in the future.


# Links

Links to official Babylon properties.

### Official Links

[Website / application](https://www.babylon.finance/)

[BABL/ETH pair on Uniswap V3](https://app.uniswap.org/#/swap?inputCurrency=0xc02aaa39b223fe8d0a0e5c4f27ead9083c756cc2\&outputCurrency=0xf4dc48d260c93ad6a96c5ce563e70ca578987c74)

[Governance (Tally)](https://www.withtally.com/governance/babylon)

[Twitter](https://twitter.com/BabylonFinance)

[Discord](https://discord.gg/ZqUrdYvt5e)

[Medium](https://medium.com/babylon-finance)

[Telegram](https://t.me/joinchat/HQ5TId7ZUCb9ktgT)

[Github](https://github.com/orgs/babylon-finance/projects/1)

[Youtube](https://www.youtube.com/channel/UCM8ieQ7AZShPVRW7g1xhO3A)

[Design Kit](https://drive.google.com/open?id=19N2k8ibtYKB-a_HRnIKuV71Pe4cy1ccf)

### External Appearances

[Media](/getting-started/social-1/media-appearances)

[Press Releases](/getting-started/social-1/press-releases)

[Research Threads](/getting-started/social-1/research-threads-articles)


# Media Appearances

A non-exhaustive lists of podcasts and media appearances of Babylon.

* Mission DeFi Episode 35

{% embed url="<https://t.co/r1sh5P51sF>" %}

* REFI Podcast Episode 16

{% embed url="<https://open.spotify.com/episode/1fS82jNYPItvAmPJK4jOir?si=5739debd27b44ef3>" %}

* Ramón presents at Inside: The Future of Finance (2021)

{% embed url="<https://www.youtube.com/watch?v=Cn-GKRwB9wc>" %}

* Building Wealth together in DeFi - The Fintech Files

{% embed url="<https://open.spotify.com/episode/198yg1FYuIv37I3deewJkM>" %}

* HackMoney2022 Kickoff Pitch

{% embed url="<https://www.youtube.com/watch?t=2080s&v=nwpDV7qTHuM>" %}


# Press Releases

{% embed url="<https://www.einnews.com/pr_news/568153007/babylon-finance-empowers-communities-to-invest-together-in-defi>" %}

{% embed url="<https://cryptonewsbtc.org/2022/04/11/babylon-finance-empowers-communities-to-invest-together-in-defi>" %}

{% embed url="<https://knowtechie.com/babylon-finance-is-transforming-investing-by-enabling-community-led-asset-management>" %}

{% embed url="<https://timebusinessnews.com/babylon-finance-facilitates-investments-in-crypto-as-a-community>" %}

{% embed url="<https://www.companionlink.com/blog/2022/05/changing-the-dynamics-of-investing-by-enabling-community-led-asset-management>" %}

{% embed url="<https://blockchainmagazine.net/babylon-finance-an-innovative-community-led-asset-management-platform-powered-by-defi>" %}

{% embed url="<https://menafn.com/1104026751/A-Quick-Look-At-What-DeFi-Is-And-How-It-Operates&source=13>" %}

{% embed url="<https://www.valuewalk.com/a-quick-look-at-what-defi-is-and-how-it-operates>" %}

{% embed url="<https://t.co/7hHsU5H21A>" %}


# Research Threads / Articles

[@AvgJoesCrypto](https://twitter.com/AvgJoesCrypto/status/1518970338025132032?s=20\&t=gScig7MjK-z6EyByNphEnA)

[@RossBoothr](https://twitter.com/rossboothr/status/1516111307367346182?s=20\&t=gScig7MjK-z6EyByNphEnA)


# Litepaper

This page includes the Babylon Litepaper, which gives an overview of the protocol.

## Abstract

Babylon is an Ethereum-based protocol that offers community-led asset management.

There are a lot of investment opportunities in DeFi but very few people that know how to take advantage of them. We believe this ever-expanding universe of opportunity is best served by a community-first approach.

Babylon enables users to create investment communities (called "Gardens") and invite members to deposit capital, suggest investment strategies, vote, and earn rewards. Users can join Gardens with an investment thesis that matches their risk, time, and liquidity preferences.

Babylon integrates with a number of different DeFi protocols to empower members with the tools they need to grow their assets under management.

### Mission

We are witnessing the end of a 30-year secular downtrend in interest rates. As a consequence, bonds are no longer a viable hedge for portfolios. At the same time, equities are at an all-time high in terms of P/E ratios. Central banks are increasing the money supply faster than ever. Inflation looms on the horizon.&#x20;

![](/files/-M_2G8-ZxOnIKkpzWXHW)

We believe crypto assets are poised to become the best-performing asset class over the next two decades.

**We want to bring everyone access to this generational opportunity.** We are rethinking asset management from scratch. We are creating an ecosystem that rewards the participants who support the best investment ideas.

### Motivation

You can read more about the principles behind Babylon [in our Medium post](https://medium.com/babylon-finance/babylons-finance-litepaper-8fdb57770615). TLDR below.

* **In a world starved for yield**, DeFi can help investors capture the convexity of the returns of the crypto asset class for the next decade. We want to give investors a way to find attractive risk-adjusted returns in a world where returns are pushed farther and farther in the risk curve. (e.g zero interest rates, bond yields inching negative, equity valuations at an all-time high).
* **Non-custodial.** Users retain ownership over their capital. The protocol, founding team, and other users cannot withdraw their capital.
* **Decentralized asset management**. Everyone can create their own Gardens. Users can become members of a Garden by depositing capital.&#x20;
* The protocol is designed to encourage **long-term holdings over short-term holdings**. It incentivizes long-term holdings with more rewards in the governance token ($BABL).
* **DeFi Together.** Members of a Garden form around an investment thesis and cooperatively decide where to allocate the group's capital for the common good.
* **Democratize access to investment**. Give everyone the chance to start their own Garden.
* **Every asset will eventually be a crypto asset.** Babylon will eventually offer every asset class. We are convinced that eventually, all asset classes are going to be tokenized and available through public blockchains. Synthetix and its tokens that track oil, gold, or the S\&P are an early example of this.
* **Gateway to DeFi**. Protocol details are hidden from the user, providing an **understandable blockchain agnostic interface and messaging**. Aggregator on the frontend, protocol on the backend.
* **Participants with skin in the game and shared upside.** Improve on the 2/20 structure from traditional hedge funds. Compensate and attract the best Strategists with strong incentives to be able to offer the best investment ideas in the world.

### Differentiation with other asset management protocols

Currently, there are two different kinds of asset management protocols.&#x20;

On one side, you have the ones that are passive like Yearn, DPI, Indexed.finance or Inverse.finance. They are trust-minimized and the strategies are coded in the smart contracts, therefore passive.&#x20;

On the other side, there are protocols like Enzyme, Set or dHedge that offer actively managed funds where a manager controls the investment decisions.

We believe there is a huge gap in the market for **actively managed investment communities**.

![](/files/-M_2ZXQjFGkpWFn6yT5v)

## Protocol overview

The Babylon protocol is an Ethereum-based protocol that enables the following:

* **ERC-20 Compatibility**. Participation in Gardens is implemented using the ERC-20 token standard. Garden Tokens are trustless and reissued/redeemed when entering/exiting the Garden.
* **Skin in the game**. Participants suggest Strategies and other members of the same Garden can upvote or downvote them. The member that created the Strategy plus the members that voted on the strategy get rewarded based on its performance. A member needs to stake a % of his participation in the Garden to be able to create a Strategy.
* **Codeless Strategy Creation**. A member can craft a Strategy combining different Defi protocols through our user interface. No need to code.
* **Protocol Fees**. To allow for protocol sustainability, the protocol may charge additional small fees based on performance and capital allocated to Strategies.
* **Governance Token ($BABL- ERC-20)**. Treasury, protocol fees, integrations, max performance fees, and reserve assets of the protocol will be controlled by the governance token holders. More info in the [governance section](#governance).
* **Participation Rewards**. Participants will receive governance tokens based on their contributions to the protocol. More details in the [Participation Rewards Program section](/babl/mining).
* **Asset Consolidation**. Investors only need to deposit a single asset (known as the reserve asset). Upon deposit and upon withdrawal, the protocol will automatically consolidate the assets to facilitate P\&L and accounting for the members.
* **Asset Management Innovation.** Thought from first principles. Now that Ethereum gives us strong coordination tools, there is no fundamental reason why groups need to rely on a single manager figure.
* **Multi-Protocol**. Babylon integrates with many DeFi protocols and exchanges. More information about the [integrations here](/protocol/integrations).

### Use Cases

Investors will be able to find the best Strategies in the space by participating in Gardens that focus on different aspects of the crypto market.&#x20;

Over the years, crypto insiders are always receiving questions from friends and family about how to get started and invest in the space. It is not scalable to educate every single person one on one. Babylon is designed to create a multi-sided marketplace where many different members can benefit from the knowledge of DeFi experts or Strategists.

* **If you are a DeFi expert** and you want to share your expertise with your community, group of friends, or family, come to Babylon, **set up a Garden, and help** them access this opportunity.
* If you want to **get started** in the crypto space but don't know how to start, **join a Babylon Garden**. Discuss strategies and get exposed to the market by following people that you trust.

Every Garden can have a different investment thesis and deploy capital to different assets.&#x20;

For example:

* A group wants to access yield for their stable coins with low risk. They can create a **Yield Farming Garden** that only allocates the capital to low risk strategies like the ones that can be found in Yearn or Conve&#x78;**.**
* A **Value Garden** dedicated to finding early undervalued assets with a medium to long term duration preference.
* A **Long-Short Garden** that makes directional bets based on momentum indicators and technical analysis. e.g leverage long plays on ETH.

## Babylon Gardens

Babylon Gardens operate similarly to Angel List **rolling funds**. Members can deposit more capital at any time. Whenever a Strategy in the Garden finalizes, the **capital returned by the Strategy is reserved for pro-rata redemptions**. After this period, any remaining capital can be reallocated to strategies in the Garden.

If a member **wants to withdraw outside of this window, they can do so by incurring an early penalty fee (2.5%).** The fee is paid to the Garden to compensate the remaining members for the cost of liquidating and rebalancing active Strategies.

Rewards are set aside and it is up to the members to decide if they want to claim and/or reinvest them.

### Garden Parameters

The following parameters can be defined when creating a community.

* **Garden Name**
* **Garden Description** - The Garden thesis and anything else members will want to know
* **Reserve Asset** - The asset that is used for deposits and withdrawals. Strategies consolidate into this asset upon completion and it's used as a performance benchmark.
* **Garden NFT** - Gardens receive an NFT that evolves as the Garden grows.
* **Minimum Member Deposit** - The minimum amount of capital a user needs to deposit to become a Garden member.
* **Maximum Garden Deposits** - The Maximum amount that can be deposited into a Garden by all members.
* **Deposit Hardlock** - The number of seconds a member has to wait after depositing to withdraw. Flash loan prevention.
* **Limit who can join Garden** - Makes Garden private or public.
* **Early Withdrawal Penalty** - Penalty for withdrawing capital from active Strategies.
* **Minimum Strategy Duration** - Minimum number of days a Strategy must be active.
* **Maximum Strategy Duration** - Maximum number of days a Strategy must be active.
* **% Quorum to Activate Strategy** - % of total votes needed to activate a Strategy.
* **# Stewards to Reach Quorum** - # of people who have to vote to activate a Strategy.
* **Strategy Cooldown Period** - Hours to wait before activating a Strategy after quorum has been reached.&#x20;
* **Only assets above this liquidity** - Minimum liquidity of assets the Garden can invest in.

Communities behave similarly to investment clubs. Users need to **deposit** into the community to gain access to the Garden. Once they are in, as members they can perform the following actions:

* **Create Strategy**. A member can suggest a Strategy for the community. The member will need to stake a portion of his/her Garden Tokens to be able to create the Strategy.
* **Vote on a Strategy**. Members from the community can use their Garden Tokens to upvote or downvote candidate Strategies.
* **Deposit capital**. Members can deposit capital at any time.
* **Withdraw**. Members can withdraw capital - along with the profits, if any - during the redemption window or outside the window by incurring an early withdrawal penalty.&#x20;
* **Claim Rewards.** Members of a Garden can claim $BABL rewards earned through their participation in the Garden.
* **Discuss**. Communities can also integrate an off-chain message board (Telegram, Discord) to host discussions within the community.

### Withdrawal Process

When a member of the Garden wants to withdraw his principal, there are different scenarios:

* If there is **enough liquidity** in the Garden, the **user can withdraw immediately without penalty**.
* There is **not enough liquidity** in the Garden, (i.e. all the capital is allocated to active strategies), the user can choose to:
  * **Wait until Strategies finalize** and withdraw the proportional pro-rata amount of the capital allocated to the Strategy at no penalty.
  * **Withdraw immediately and pay a 2.5% penalty**. The penalty is paid to the other members of the Garden to compensate for the partial liquidation of Strategies. Withdrawing before the Strategy completes also requires giving up any potential profits and $BABL rewards that the strategy may return upon finalization.

### Garden NFTs

Each Garden in Babylon has a procedurally-generated NFT that's a 3D representation of the Garden. The NFT changes as the Garden grows. We expect Gardens will eventually use these NFTs as membership badges and to provide access to special opportunities.&#x20;

Members have the option to claim the Garden NFT when they deposit into the Garden. For more information, see [this blog post](https://medium.com/babylon-finance/babylon-is-rising-11e09ae1192f).

## Strategy Lifecycle

### Strategy Creation

The Strategist creates the Strategy through the no-code UI. This process includes selecting the operations for the Strategy -- e.g. longing Bitcoin or lending ETH -- and defining the parameters for the Strategy.

### Voting Period

After the Strategy has been created it is proposed to the Garden and the voting period begins. The voting period lasts for a maximum of seven days and any member who has permission to vote can vote for or against the Strategy using the full weight of their Garden Tokens.&#x20;

Once a vote is cast it can't be changed. If seven days pass and the Strategy does not meet quorum, it is canceled. If the Strategy receives enough votes to meet quorum, it immediately enters the first cooldown.

### First Cooldown

This period lasts for half of the "cooldown period" set during Garden Creation. For example, if the Garden cooldown period is 10 hours, the first cooldown would last for five hours. During the first cooldown, anyone who hasn't yet voted for the Strategy can cast a vote. If at the end of the first cooldown the Strategy no longer meets quorum, it returns to the voting period. If at the end of the first cooldown the Strategy still meets quorum, it enters the second cooldown.

### Second Cooldown

This period lasts for the same amount of time as the first cooldown period. No one can vote during this period. It exists to allow Garden members to withdraw funds prior to the Strategy being executed. Following the second cooldown period, the Strategy is executed.

### Strategy Execution

Within 10 minutes following the completion of the second cooldown, the Strategy will receive capital from the Garden and be executed by the Keeper. In some instances, the Keeper may wait to execute the Strategy (e.g. if the cost of gas is too high or if there isn't enough Garden capital to allocate to the Strategy).

### Strategy Completion

Once the Strategy duration is complete, the Strategy will unwind and automatically convert all of the Strategy assets back into the Garden's reserve asset. The Strategy can also be completed early by the Strategist.

## Voting Mechanics

Gardens use **capital-weighted voting**. Members can vote according to how many Garden Tokens they hold, which they receive based on the amount of capital they deposit into the Garden. The more skin in the game users have in the Garden, the more Garden Tokens they will have at their disposal.

**Voting is completely optional for members**. We expect that only a small number of members will have enough information to vote on each Strategy. When a member votes on a Strategy, the voter is signaling whether the Garden should deploy capital to it.&#x20;

### Measuring conviction

* Votes can be **positive** (upvotes) or **negative** (downvotes).
* A **positive vote** means that the user believes that the Strategy will perform as designed, reaching or surpassing the expected return set by the Strategist, and should be executed.
* A **negative vote** means that the user believes that the Strategy will perform below expectations and should not be executed.

### Voting rewards

The more tokens that are used to vote on a Strategy, the bigger the potential for $BABL and Profit Rewards. Members can vote with all of their Garden Tokens on any Strategy, including with tokens that were staked on other Strategies during Strategy creation.

### Off-chain Voting

To allow everyone to vote without spending hundreds of dollars in gas, we are doing this **off-chain through signatures.** This makes voting gas-free for users.

## Profit & Reward Split

Babylon reinvents the traditional fund model. In traditional funds, there is a 2% management fee and a 20% performance fee. In Babylon, the protocol charges a 0.5% fee on total assets and a 5% fee on profits. These fees flow into the protocol treasury, which is governed by holders of $BABL, the protocol's governance token.

During Garden creation, the Creator can define how the remaining 95% of profits are split between the various Garden participants. For example, a Garden could award 5% of profits to the Strategist, 5% to Voters, and the remaining 90% to all members.

When profit rewards are allocated to Voters, they are divided proportional to the number of Garden Tokens each Voter used to vote on the Strategy.

Besides the profit split, every completed strategy will receive $BABL rewards. Head to the [BABL Rewards Proposal](/babl/mining) page for more details.

## Architecture (Smart Contracts)

The architecture integrates and builds on top of lessons learned by other protocols like Yearn and Set.

**Protocol Diagram**

Here is a simplified diagram of the protocol with the main actors and smart contracts

![](/files/-M_RtZpb8vcnX0G2aA_6)

### **Babylon Controller**

The Controller manages the list of Strategies available, the list of Gardens, and fees for the protocol. It also controls the profit split along with the $BABL Participation Mining Program parameters.

The list of allowed reserve assets is also curated by governance. Initially, members can deposit ETH, WETH or DAI and they will receive back the deposited asset when they withdraw.

### **Garden**

ERC-20 contract that keeps track of positions that the community holds. Handles deposits and withdrawals. Investors can **deposit at any moment** but can only withdraw capital that is not allocated to active strategies. If a member **wants to withdraw outside of this window, he/she can do so by incurring an early penalty fee (2.5%).**&#x20;

### **Strategies**

Every community has a different contract with strategies. This includes the strategies that have not been activated yet (candidates), Strategies that are currently open (active), and Strategies that were completed (completed). It also controls all the voting mechanics within that Garden.

### **GardenValuer**

Uses the price oracle to go through all the positions of the Garden and calculate the total value of the Garden (AUM).

### **Integrations**

We have a list of integrations in the controller that connect with external protocols.

&#x20;**IBorrow** -> Interface for lending protocols. E.g **Aave, Compound**.

&#x20;**IPool** -> Interface for liquidity pools. **Balancer, uniswap**, **sushiswap & OneInchPool**.

&#x20;**ITrade** -> Interface for buying/selling assets. **1Inch, Kyber**.

&#x20;**IPassive** -> Interface for passive protocols. **Yearn Vaults**, AlphaHomora, **Harvest**.

[More about Integrations here](/protocol/integrations).

### **PriceOracle**

Single contract for all supported token prices. Only the protocol and the funds can use it. Uses Uniswap V3 Oracles to prevent sandwich attacks.

**$BABL**

ERC-20. Governance token of the protocol.

## Governance

More about [governance here](/babl/governance).


# Participants

This page describes the participants in Babylon and their roles.

Individuals become Garden members by depositing capital and receiving an ERC-20 token representing their membership in the Garden.&#x20;

Any user can create and bootstrap a Garden. Once a Garden is created, there are three implicit roles that can be assumed and they are open to Garden members who have the necessary permissions. Gardeners set and manage permissions for all members of their Garden.

## 🌱 Gardener

The Gardener (creator of the Garden) is responsible for setting the thesis of the Garden, defining asset and protocol constraints, and paying the initial gas fees necessary to create the Garden. Their goal is to build and grow an effective investment community. To encourage active participation, the Gardener receives a **bonus** on the rewards he/she would receive as a Strategist, Curator, and/or LP in the Garden.

## 🧧 LP

This is the default role of participants that contribute capital to a Garden. Over time LPs receive rewards relative to their fractional position of capital in the Garden.

## 📰 Voter

This role is assumed by members who want to vote on candidate Strategies and receive rewards. By voting on Strategies, Voters decide which Strategies become active.

## 🧠  Strategist

Strategists submit candidate Strategies to the Garden and are rewarded for successful investments. Strategists take on additional risk in exchange for much greater opportunity in rewards by staking some of their Garden Tokens as part of a Strategy submission.

### Table of Participants and Rewards

| Stakeholder     | Value they provide                                                                                                                                                                       | Benefits                                     | Max Returns                                              |
| --------------- | ---------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- | -------------------------------------------- | -------------------------------------------------------- |
| **LP / member** | <p>Capital.</p><p>Signal on Communities.</p>                                                                                                                                             | Alpha, potential returns that beat the index | Profit rewards are determined by the Garden              |
| **Strategist**  | <p>Strategies</p><p>Alpha generation</p>                                                                                                                                                 | 10% BABL rewards                             | Profit rewards are determined by the Garden              |
| **Voters**      | Signal on Strategies                                                                                                                                                                     | 10% BABL rewards                             | Profit rewards are determined by the Garden              |
| **Gardener**    | <p>Community Bootstrapping.</p><p>Investment Thesis.</p>                                                                                                                                 | 1.10x Rewards Bonus                          | Profit rewards are determined by the Garden              |
| **Keepers**     | <p>Execute Strategies when they reach quorum.</p><p>Finalize Strategies when their duration ends.</p><p>Rebalance capital from the community to the active Strategies when necessary</p> | Gas Fees                                     | None initially. The founding team will run them at cost. |

## Permissions

During Beta, granting permission to access it is managed by the Babylon team. After Beta, anyone will be able to create a Garden.

All other permissions, including the ability to deposit into a private Garden, submit Strategies, and/or vote on Strategies, are managed by the Gardener for their Garden.

The first Settlers of Babylon needed to have a single Ishtar Gate NFT in their wallet to access the beta. This NFT proves they were one of the first 300 Settlers.

For more information, see [this blog post.](https://medium.com/babylon-finance/babylon-is-rising-11e09ae1192f)


# Gas Optimizations

The protocol offers many advantages to users regarding gas costs.

At Babylon.finance, our core mission is to help people accumulate wealth through **community-led funds on DeFi**.

We believe crypto is a new asset class that will overperform any other asset during the next two decades. Therefore we believe that **DeFi needs to be more accessible** so more people can have the opportunity to create wealth.

As the price of ETH and ETH gas costs have increased, **many people have been priced out of DeFi**.

We have been working hard to offer several gas benefits to our users:

* First of all, Gardens allow members to **share the execution costs** of a strategy. For example, if you have a garden with a strategy to buy the token UNI and there are a hundred members, you only need to execute one swap instead of one hundred.
* Secondly, we developed some wizardry to allow you to [**deposit in gardens via signature**](/protocol/gas-optimizations/gasless-deposits). Signature deposits reduce gas costs by 60% and the best part is that you don't even need ETH.
* Thirdly, the strategist can set a **max gas fee % per strategy**. The keeper will only execute and finalize strategies when it is capital efficient to do so.
* Finally,  gardens and the treasury of the protocol are subsidizing deposits. If you deposit when the gas price is below 125 gwei, your **deposit will be free**. If the gas price is below 500 gwei, you will get a 25-50% discount on the deposit.

Learn more about [gasless deposits](/protocol/gas-optimizations/gasless-deposits) here.


# Gasless Deposits

![Gasless Deposits](/files/uT6YGTXUBVDKpYv3HWvz)

You can see the original announcement on medium [here](https://medium.com/babylon-finance/introducing-gasless-deposits-51e2d31ccd3f).

We’ve created **signature-based deposits & withdrawals**.

Instead of paying an additional fee in ETH to deposit, Babylon will take the necessary fee from the asset you are depositing. And sometimes there will be no fee to deposit at all because it will be subsidized by the garden.

So, you **don’t need ETH to deposit DAI, WETH, or any other asset.** And you can decide in Metamask the maximum amount you’re willing to pay, denominated in the asset that is being deposited.

Here’s a video showing you how to make a signature-based deposit:

{% embed url="<https://www.youtube.com/watch?feature=emb_imp_woyt&v=IZ5CQaP0JDQ>" %}

On top of it, the treasury of the protocol and the gardens are subsidizing the deposit cost for new members in specific gardens.&#x20;

Your **deposit can be even free** when the gas price is below 125 gwei.


# Integrations

This page provides a list of DeFi Protocols that Babylon integrates with.

Each Garden will be able to choose where to deploy their capital and which protocols to use. We hope to enable visionary Strategists by providing a rich set of integrations and balanced incentives for both Strategists and LPs. We see the space as a **positive-sum game** and it’s our goal to provide as much liquidity to the ecosystem as we can.

![](/files/Adq4w5lyR7auj1vxD8RX)

Babylon integrates with the following DeFi protocols:

* Uniswap v3 for trades and price oracle
* Uniswap v2 LP tokens
* Compound lending and borrowing
* Aave lending and borrowing
* Sushiswap pools
* Lido staking
* Stakewise ([Announcement](https://medium.com/babylon-finance/stakewise-integration-d447d75cd545))
* Yearn vaults ([Full List & Announcement](https://medium.com/babylon-finance/curve-yearn-babylon-7f4d298b5a9b))
* Babylon Fuse Pool on Rari ([Annoncement](https://medium.com/babylon-finance/babylon-lending-markets-e0aee652e8c2))
* Pickle Jars ([Full List & Announcement](https://medium.com/babylon-finance/babylon-pickles-a88846083788?postPublishedType=initial)) & Pickle Farms([Announcement](https://medium.com/@rrecuero/babylon-pickle-reloaded-8cf2a1931630))
* Curve Pools ([Full list](https://medium.com/babylon-finance/curve-pools-available-on-babylon-c3f9e617d028))
* Curve Gauge Staking ([Announcement](https://twitter.com/BabylonFinance/status/1523910894069059584?s=20\&t=dS8v9VH4nKDLHV-iMb0uUg))
* Aladdin DAO v3([Announcement](https://babylon.finance/daos))
* Convex Staking ([Announcement](https://medium.com/babylon-finance/convex-staking-available-on-babylon-769717ed1e53))
* Gamma Uni V3 LP ([Announcement](https://docs.babylon.finance/babl/heart/heart-bonds))

### Wishlist :moneybag:

The following integrations are on our wishlist. Thanks to our SDK, anyone can build [Custom Integrations](/developers/custom-integrations) with our protocol. The first person that successfully completes each of these integrations and follows the process outlined on that page, will receive up to $5k in developer bounties paid in (BABL).

* ~~BadgerDAO (Investing in Sett vaults)~~
* ~~Balancer V2~~
* Bancor V3
* PoolTogether
* Abracadabra
* ~~Alpha Homora V2~~
* Liquity (Lend & Borrow)
* Maple Finance (Deposit in Pools)
* Centrifuge
* ~~Idle Finance~~


# Roadmap

This page describes the Babylon roadmap.

![](/files/F2Il6FRSxYpdQfGVjWzN)

## **Product Roadmap**

You can see the board with the most requested features here:

{% embed url="<https://babylonfinance.canny.io>" %}

## **Team Alpha (May 2021)**

The protocol was deployed on mainnet and the application was available for the team to test and iterate based on feedback.

There were no $BABL rewards enabled.

[Litepaper](/protocol/litepaper) was released.

First security audit by Red4Sec was completed.

## **Private Alpha (May - June 2021)**

The Babylon team and seed investors continued to battle-test the protocol, gather feedback, and iterate.

There were no $BABL rewards enabled.

## Settlers Beta (June 2021 - Dec 2021)

Settlers are invited to create and join the first investment communities (called “Gardens”) in our private beta, similar to how settlers in ancient Babylon established a small village that grew into a bustling civilization.

You can read more details in the [full announcement](https://medium.com/babylon-finance/settlers-beta-81ee635d7c57).

[BABL Mining rewards](/babl/mining) are scheduled to start on October 17th 2021.

Undergoing two more security audits.

## Public Launch V1 (March 2022)

After subsequent security audits and once the protocol and the community are robust enough, Babylon will launch publicly and open source the smart contracts.


# Building on Babylon

## Why build on Babylon?

Babylon provides a new DeFi lego building block for developers: :palm\_tree: Babylon Gardens.

Babylon Gardens are the first **DeFi Investment DAO primitive (ERC-20)**.

See our workshop video in HackMoney 2022 to learn how to get started.

{% embed url="<https://www.youtube.com/watch?v=nLKtwckXBKU>" %}

Gardens are tokenized investment clubs/DAOs where users can deposit digital assets and receive a tokenized share (ERC-20) representing their ownership.

Developers can build on top of Babylon Gardens and benefit from all the following built-in features.

You can read more in our medium announcement here

{% embed url="<https://medium.com/@rrecuero/babylon-on-chain-sdk-438d6f61b7e7>" %}

### Built-in Features

* Garden ERC-20 tokens are **fully composable and transferrable**.
* Gardens are **non-custodial and trust minimized**. Only users have access to their funds. Capital can only be allocated to strategies approved by the club.
* Gardens also provide an **NFT Membership token (ERC-721)**. Members of a garden that meet selected requirements can mint their NFT.
* **Built-in light governance system with signature-based voting**. Gas-free.
* No-hassle and **No code UI** to create strategies and deploy capital to [+15 DeFi protocols](/protocol/integrations) including Aave, Compound, Uniswap, Curve, and Convex.
* **DeFi execution costs are automatically shared** between all members of a Garden, increasing the capital efficiency.
* Smart capital allocation between strategies based on current gas costs and settings.
* **Garden UI** where users & managers can deposit/withdraw and monitor the performance of their investment club.

You can read more on our [managers page](https://www.babylon.finance/managers).

## What can you build?

The design space is unlimited. You can connect the gardens with the rest of DeFi and web3 in many different ways.&#x20;

For example:

* **Create an investment club to invest with your friends** through a Babylon garden. This was the original usecase that prompted us to start Babylon. You can learn more about our origin story [here](https://www.youtube.com/watch?v=Cn-GKRwB9wc).
* You can use a garden as a way **to generate an index of different DeFi opportunities**. For example, here is a Garden that gives exposure [to many different Pickle Jars at once](https://twitter.com/ramonrecuero/status/1522351546922520578?s=20\&t=MbqSGb9flyUdscEEWX0iSQ).
* You can use a garden to **simplify access to DeFi opportunities across different protocols**. For example, the ⛲ [Fountain of ETH](https://www.babylon.finance/garden/0xB5bD20248cfe9480487CC0de0d72D0e19eE0AcB6) generates yield on ETH by taking advantage of staking opportunities across different protocols.
* You can use a garden **to create a supercharged staking mechanic for any ERC-20 token.** You can see more information [here](https://babylon.finance/daos). We use a garden to create a staking mechanic for BABL itself, [see the Heart](https://medium.com/babylon-finance/the-heart-of-babylon-defi-3-0-6d16e35817f2) 🫀.
* Automatically **create and deploy strategies to react to events and market conditions**. You can execute and trigger strategies directly from your smart contracts.

**Gardens and strategies can be created on-chain directly from your smart contracts** in a response to an event or directly through our user interface. Check the section below to learn more about the API.

## Testnets

Instead of using Ethereum testnets like Ropsten or Kovab, Babylon Finance uses [Hardhat](https://hardhat.org/) chain for testing and local development.&#x20;

Babylon Finance integrates with +15 DeFi protocols. Therefore creating a full-working deployment on testnests like Kovan or Ropsten is really cumbersome and prone to errors.&#x20;

**Hardhat lets you clone Ethereum Mainnet and run the clone on your local machine and then you can deploy contracts on top of your cllone**.&#x20;

That way you can build on top of mainnet with all its functionality and DeFi protocols with Ease.

## Smart Contracts

You can view all the information required in our API docs.

{% content-ref url="/pages/PuaTRQOFtommNwxXjE6W" %}
[Smart Contract API](/developers/smart-contract-api)
{% endcontent-ref %}

You can see their deployment addresses on the deployments page:

{% content-ref url="/pages/-MhxFZVjAGlKqlrUSYVK" %}
[Deployments](/developers/deployments)
{% endcontent-ref %}

Do you want to connect Babylon to another DeFi protocol that is not supported? Now you can build a custom integration and potentially receive bounties.

{% content-ref url="/pages/U1gTUgb6edhmtulmEn2I" %}
[Custom Integrations](/developers/custom-integrations)
{% endcontent-ref %}

## How to get started

Here are the steps we recommend to get started.

1. You can create an investment club by calling `createGarden` on the [Babylon Controller](/developers/smart-contract-api/babcontroller) or using our UI at <https://babylon.finance/explore>.
2. Once the garden is created, you have your own fully composable tokenized investment DAO as an ERC-20.
3. You can compose gardens and their strategies with the rest of #DeFi. Check the [Garden](/developers/smart-contract-api/garden) and [Strategy](/developers/smart-contract-api/strategy) APIs to see the functions available.
4. If you want to connect Babylon to a different protocol, please follow the [custom integration guide](/developers/custom-integrations).

If you have any trouble, please head to the [development channel in our Discord](https://discord.gg/KMnrHrVJZh) and we'll do our best to help.


# Custom Integrations

This page will show you how to create a new integration to connect Babylon to a new DeFI protocol.

**Integrations** are adapters that Babylon uses to **connect with other DeFi & Web3 protocols**.

So far, Babylon has developed all these adapters in-house. You can see the [whole list here.](/protocol/integrations)

![](/files/nudFe3fdrIGuahEUdo69)

Starting today, anyone can develop an adapter, test it on a private garden and then submit it to be verified and audited by Babylon governance.

## Requirements

* Only gardens with the flag `customIntegrationsEnabled` can create strategies that use custom integrations.
* The protocol you are connecting with **must return an ERC-20 token** in an amount proportional to the capital provided by the strategy.
* The resulting ERC-20 tokens need to be priced on-chain in a safe and reliable way. Enough liquidity, resistant to manipulation...

## Architecture Recap

Babylon has 1-N gardens or investment clubs.

Every Garden has 0-N active strategies at any single moment.

![](/files/yYMTjBVCQC2Zz6mqOjM8)

Every strategy has 1-N DeFi operations it executes to start and exit a strategy.

Every **operation uses one adapter** to connect to an specific DeFi protocol.

## How to build a custom integration?

In order to facilitate the process as much as possible, we have created a template called `CustomIntegrationTemplate.sol` that you can copy and paste and rename to start working on your custom integration.

You can also look at the example `CustomIntegrationYearn` to see how to connect with Yearn using the template.

### Steps to build your integration

To complete the integrations, there are a few functions that need to be filled. You can read more about their signatures and parameters on their [API page](/developers/smart-contract-api/custom-integrations).

1. Copy `CustomIntegrationTemplate.sol` and rename it.
2. Add any state variables you would need.
3. Modify the constructor to receive any extra parameters you need on deployment. Change the name `test_`*`sample_`*`change_me`

```
constructor(IBabController _controller) CustomIntegration('**test_sample_change_me**', _controller) {
    require(address(_controller) != address(0), 'invalid address');
}
```

4\.  Fill the function that checks whether the **parameters passed on execution to this operation are valid**. These are different than the constructor parameters. These are the configurable parameters. For example, which yearn vault to enter.

```
function _isValid(
    bytes memory /* _data */
) internal pure override returns (bool) {
    /**FILL THIS*/
    return true;
}
```

5\.  Fill `_getSpender`, this function returns the address where the input tokens need to be approved to before execution. This address will be called with ERC-20 approve and the input tokens before execution.

```
function _getSpender(
    bytes calldata, /* _data */
    uint8 /* _opType */
) internal pure override returns (address) {
    /** FILL THIS */
    return address(0);
}
```

6\.  Implement `_getResultToken`. This function must return the result token (ERC-20) to be received after executing the enter operation.

```
function _getResultToken(address _token) internal pure override returns (address) {
    /** FILL THIS */
    return _token;
}
```

7\. Provide the input tokens and the weights of these tokens. The strategy will automatically **buy these tokens with the capital before entering the strategy** according to these weights.

```
function getInputTokensAndWeights(
    bytes calldata /* _data */
) external pure override returns (address[] memory _inputTokens, uint256[] memory _inputWeights) {
    /** FILL THIS */
    return (new address[](1), new uint256[](1));
}
```

8\. Provide the **output tokens and the minimum amounts to receive for each upon exit** based on \_liquidity amount of the result token defined abov&#x65;**.**

```
function getOutputTokensAndMinAmountOut(
    bytes calldata, /* _data */
    uint256 /* _liquidity */
) external pure override returns (address[] memory exitTokens, uint256[] memory _minAmountsOut) {
    /** FILL THIS */
    return (new address[](1), new uint256[](1));
}
```

**9. Provide the enter calldata**. You must return the calldata required for the strategy to allocate capital to this integration.

```
function _getEnterCalldata(
    address, /* _strategy */
    bytes calldata, /* _data */
    uint256, /* _resultTokensOut */
    address[] calldata, /* _tokensIn */
    uint256[] calldata /* _maxAmountsIn */
)
    internal
    pure
    override
    returns (
        address,
        uint256,
        bytes memory
    )
{
    /** FILL THIS */
    return (address(0), 0, bytes(''));
}
```

10\. **Provide the exit calldata**. You must return the calldata required for the strategy to exit and recover the capital allocated through this integration.

```
function _getExitCalldata(
    address, /* _strategy */
    bytes calldata, /* _data */
    uint256, /* _resultTokensIn */
    address[] calldata, /* _tokensOut */
    uint256[] calldata /* _minAmountsOut */
)
    internal
    pure
    override
    returns (
        address,
        uint256,
        bytes memory
    )
{
    /** FILL THIS */
    return (address(0), 0, bytes(''));
}
```

11\. (Optional). Provide the list of reward tokens that will be received upon exit. List of ERC-20 addresses.

```
/**
 * The list of addresses of the IERC-20 tokens mined as rewards during the strategy
 *
 * hparam  _data                      Address provided as param
 * @return address[] memory           List of reward token addresses
 */
function _getRewardTokens(
    address /* _data */
) internal pure override returns (address[] memory) {
    return new address[](1);
}
```

12\. (Optional) If the result tokens cannot be priced through Babylon Price Oracle, you need to implement the following function that returns the price of the result token in the `_tokenDenominator`

```
function getPriceResultToken(
    bytes calldata, /* _data */
    address /* _tokenDenominator */
) external pure override returns (uint256) {
    /** FILL THIS */
    return 0;
}

```

13\. (Optional) If you need to execute another custom action before entry or exit, you can define a pre-action hook. `_customOp` will be 0 for enter and 1 for exit. If this action needs to execute an ERC approval you can fill `_preActionNeedsApproval`.

```
/**
 * (OPTIONAL). Return pre action calldata
 *
 * hparam _strategy                  Address of the strategy
 * hparam  _asset                    Address param
 * hparam  _amount                   Amount
 * hparam  _customOp                 Type of Custom op
 *
 * @return address                   Target contract address
 * @return uint256                   Call value
 * @return bytes                     Trade calldata
 */
function _getPreActionCallData(
    address, /* _strategy */
    address, /* _asset */
    uint256, /* _amount */
    uint256 /* _customOp */
)
    internal
    view
    override
    returns (
        address,
        uint256,
        bytes memory
    )
{
    return (address(0), 0, bytes(''));
}
```

14\. (Optional) Similarly, if you need to execute another custom action after entering or exiting, you can define a pre-action hook. `_customOp` will be 0 for enter and 1 for exit.  If this action needs to execute an ERC approval you can fill `_postActionNeedsApproval`.

```
/**
 * (OPTIONAL) Return post action calldata
 *
 * hparam  _strategy                 Address of the strategy
 * hparam  _asset                    Address param
 * hparam  _amount                   Amount
 * hparam  _customOp                 Type of op
 *
 * @return address                   Target contract address
 * @return uint256                   Call value
 * @return bytes                     Trade calldata
 */
function _getPostActionCallData(
    address, /* _strategy */
    address, /* _asset */
    uint256, /* _amount */
    uint256 /* _customOp */
)
    internal
    view
    override
    returns (
        address,
        uint256,
        bytes memory
    )
{
    return (address(0), 0, bytes(''));
}
```

### Utils

You can use the following functions directly from your custom integration:

#### `_getPrice(address _tokenIn, address _tokenOut) view returns (uint256)`

It gets you the price of `_tokenIn` denominated in `_tokenOut` from our price oracle (1e18). It will return an exception if it doesn't know how to price a specific token.

**`_getDurationStrategy(address _strategy) view returns (uint256)`**

It returns the duration of the strategy in seconds.

#### `_getTokenOrETHBalance(address _strategy, address _token) view returns (uint256)`

Returns the balance of the strategy of the `_token`. If token is 0x or 0xEEEE..EEE, it will return the ETH balance of the strategy.

#### `_getTradeCallData(address _strategy, address _tokenIn, address _tokenOut, uint256 _amountIn, uint256 _minAmountOut) view returns (address, uint, bytes memory)`

Receives the trade call data needed to execute a swap of `_tokenIn` to `_tokenOut.` The number of \_tokenIn supplied is specified by`_amountIn`. The call will revert if you don't receive at least `_minAmountOut`. It returns the address, callvalue, and calldata to pass directly to a preaction hook, postaction hook, enter or exit functions

## Testing the custom integration

In the `contracts` repository there is a test file that executes the yearn custom integration example. In order to test your integration, follow these steps:

1. Change the integration to deploy to the name of your custom integration. Pass the appropriate params depending on your constructor

![](/files/fCiEzna7sc7qcYUFFHAM)

&#x20;   2\. Run `yarn run test`. That's it, you can start debugging 🎉

The test suite will automatically create a strategy with your integration, approve it, allocate capital to it, execute it and finalize it.

## Testing on mainnet with a live garden

You can also test it directly on mainnet using the [Test WETH garden](https://www.babylon.finance/garden/0x2c4Beb32f0c80309876F028694B4633509e942D4) on the Babylon website or creating your own garden. Make sure you enable custom integrations in the garden parameters.

* Deploy your custom integration to mainnet.
* Deposit the min amount to join the test garden.
* Submit a new strategy and select your custom integration as one of the operations. Set the address of your deployed integration as the integration address. You can also add two optional params that the integration will receive on execution, an address and a number.

![](/files/xjmIgqXn1nIHhrl8qawi)

It should execute automatically in two hours given that strategies automatically reach quorum in this garden and do not need voters.

## Submitting it for approval

After the tests above pass for your integration, please follow the next steps:

* Clone the repo and **submit a PR** against the `contracts` repo.
* **Head to our Discord and post a message** explaining your integration and adding the link to your PR in the `#development` channel.
* We'll **review your PR** and follow up to get it audited and eventually incorporated into our list of verified integrations.
* We may **award a bounty** if the integration is approved and it is one of the integrations on our wishlist.


# Smart Contract API

Here you can find the function definitions of the main contracts of Babylon Finance.

* [Babylon Controller](/developers/smart-contract-api/babcontroller)
* [Garden](/developers/smart-contract-api/garden)
* [Strategy](/developers/smart-contract-api/strategy)
* [Custom Integrations](/developers/smart-contract-api/custom-integrations)

### Repos

You can access all the interfaces of our contracts in our Github repository:

{% embed url="<https://github.com/babylon-finance/core-interfaces>" %}

You can also find our Prophets NFT repository here:

{% embed url="<https://github.com/babylon-finance/prophets>" %}


# BabController

Deployment Address: [0xd4a5b5fcb561daf3adf86f8477555b92fba43b5f](https://etherscan.io/address/0xd4a5b5fcb561daf3adf86f8477555b92fba43b5f)

Interface: [IBabController.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/interfaces/IBabController.sol)

## Functions

The following functions can be called by any user or public roles.

### CreateGarden

*Public: Anyone can call this function.*

This function creates a new garden and adds it to the Babylon controller.

```
function createGarden(
    address _reserveAsset,
    string memory _name,
    string memory _symbol,
    string memory _tokenURI,
    uint256 _seed,
    uint256[] calldata _gardenParams,
    uint256 _initialContribution,
    bool[] memory _publicGardenStrategistsStewards,
    uint256[] memory _profitSharing
) external payable returns (address);
```

{% hint style="info" %}
Creator must have called ERC-20 approve with the reserve asset and initial contribution on the controller address.
{% endhint %}

| Parameter                                        | Description                                                                                                                                                                                                                          |
| ------------------------------------------------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `address  _reserveAsset`                         | Address of the reserve asset. WETH, DAI, AAVE, USDC & WBTC are supported.                                                                                                                                                            |
| `string memory _name`                            | Name of the Garden                                                                                                                                                                                                                   |
| `string memory _symbol`                          | ERC-20 symbol of the Garden token                                                                                                                                                                                                    |
| `string memory _tokenURI`                        | Token URI of the membership NFT                                                                                                                                                                                                      |
| `uint256 _seed`                                  | Seed to retrieve the garden NFT                                                                                                                                                                                                      |
| `uint256[] calldata _gardenParams`               | Array of 12 garden parameters. See  below.                                                                                                                                                                                           |
| `uint256 _initialContribution`                   | Amount of reserve asset to be deposited by the creator                                                                                                                                                                               |
| `bool[] memory _publicGardenStrategistsStewards` | Three booleans. First one specifies whether the garden is public or private. Second one specifies whether or not anyone can create strategies. Third one specifies whether or not anyone can vote to approve strategies.             |
| `uint256[] memory _profitSharing`                | Three numbers, 18 decimals each. 1e18 means 100%. The three numbers must add up to 95%. They represent the strategist share of profits, steward share of profits and lp share of profits. You can pass three 0s to use the defaults. |

Definition of the garden parameters:

```

 * @param _maxDepositLimit             Max deposit limit in reserve asset units
 * @param _minLiquidityAsset           Number that represents min amount of liquidity denominated in reserve asset
 * @param _depositHardlock             Number that represents the time deposits are locked for
 *                                     an user after the deposit. In seconds.
 * @param _minContribution             Min contribution to the garden in reserve asset units
 * @param _strategyCooldownPeriod      How long after the strategy has been activated, will it be ready
 *                                     to be executed. In seconds.
 * @param _minVotesQuorum              Percentage of votes needed to activate an strategy (0.01% = 1e14, 1% = 1e16)
 * @param _minStrategyDuration         Min duration of an strategy. In seconds.
 * @param _maxStrategyDuration         Max duration of an strategy. In seconds.
 * @param _minVoters                   The minimum amount of voters needed for quorum.
 * @param _pricePerShareDecayRate      Decay rate of price per share. 1e18= 100%
 * @param _pricePerShareDelta          Base slippage for price per share. 1e18= 100%
 * @param _canMintNftAfter             Can mint NFT after being a member for X secs.
 
```

#### RemoveGarden

*Only Owner: Only the garden owner can call this function.*

This function removes a garden from the controller. The Garden won't be able to execute any more strategies. Garden can only be removed if there are no active strategies.

```
function removeGarden(address _garden) external;
```

| Parameter         | Description                     |
| ----------------- | ------------------------------- |
| `address _garden` | Address of the garden to remove |

### ClaimRewards

*Public: Anyone can call this function*

This function adds a referral amount earned by a depositor and referrer.

```
function claimRewards() external;
```

## Privileged Functions

### AddReserveAsset

*Only Governance or team multisig can call this function*

This function adds a new reserve asset to the controller

```
function addReserveAsset(address _reserveAsset) external;
```

| Parameter               | Description                         |
| ----------------------- | ----------------------------------- |
| `address _reserveAsset` | Address of the reserve asset to add |

### RemoveReserveAsset

*Only Governance or team multisig can call this function*

This function removes a reserve asset from the controller

```
function removeReserveAsset(address _reserveAsset) external;
```

| Parameter               | Description                            |
| ----------------------- | -------------------------------------- |
| `address _reserveAsset` | Address of the reserve asset to remove |

### UpdateProtocolWantedAsset

*Only Governance or team multisig can call this function*

This function indicates the heart to purchase an asset to keep it under PCV.

```
function updateProtocolWantedAsset(address _wantedAsset, bool _wanted) external;
```

| Parameter              | Description                                                           |
| ---------------------- | --------------------------------------------------------------------- |
| `address _wantedAsset` | Address of the asset to purchase                                      |
| `bool _wanted`         | Boolean indicating whether the asset should be purchased by the heart |

### UpdateGardenAffiliateRate

*Only Governance or team multisig can call this function*

This function sets a referral program for a specific garden

```
function updateGardenAffiliateRate(address _garden, uint256 _affiliateRate) external;
```

| Parameter                | Description                                                            |
| ------------------------ | ---------------------------------------------------------------------- |
| `address _garden`        | Address of the garden                                                  |
| `uint256 _affiliateRate` | Amount of BABL to award for the referral for unit of the reserve asset |

### AddAffiliateReward

*Only Garden contracts can call this function*

This function adds a referral amount earned by a depositor and referrer.

```
function addAffiliateReward(
    address _depositor,
    address _referrer,
    uint256 _reserveAmount
) external;
```

| Parameter                | Description                                    |
| ------------------------ | ---------------------------------------------- |
| `address _depositor`     | Address of the depositor                       |
| `address _referrer`      | Address of the referrer                        |
| `uint256 _reserveAmount` | Amount of the reserve asset that was deposited |

### EditPriceOracle

*Only governance or team multisig can call this function.*

This function edits the price oracle of the protocol.

```
function editPriceOracle(address _priceOracle) external;
```

| Parameter              | Description                     |
| ---------------------- | ------------------------------- |
| `address _priceOracle` | Address of the new price oracle |

### EditMardukGate

*Only governance can call this function.*

This function edits the marduk gate (whitelist checker).

```
function editMardukGate(address _mardukGate) external;
```

| Parameter             | Description                    |
| --------------------- | ------------------------------ |
| `address _mardukGate` | Address of the new marduk gate |

### EditGardenValuer

*Only governance or team multisig can call this function.*

This function edits the contract that calculates the price of a garden token.

```
function editGardenValuer(address _gardenValuer) external;
```

| Parameter               | Description                      |
| ----------------------- | -------------------------------- |
| `address _gardenValuer` | Address of the new garden valuer |

### EditTreasury

*Only governance can call this function.*

This function edits the address of the treasury.

```
function editTreasury(address _newTreasury) external;
```

| Parameter              | Description                 |
| ---------------------- | --------------------------- |
| `address _newTreasury` | Address of the new treasury |

### EditHeart

*Only governance or team multisig can call this function.*

This function edits the address of the heart.

```
function editHeart(address _newHeart) external;
```

| Parameter           | Description              |
| ------------------- | ------------------------ |
| `address _newHeart` | Address of the new heart |

### EditRewardsDistributor

*Only governance can call this function.*

This function edits the address of the reward distributor.

```
function editRewardsDistributor(address _rewardsDistributor) external;
```

| Parameter                      | Description                           |
| ------------------------------ | ------------------------------------- |
| `address` \_rewardsDistributor | Address of the new reward distributor |

### EditGardenFactory

*Only governance or multisig can call this function.*

This function edits the address of the garden factory contract.

```
function editGardenFactory(address _newGardenFactory) external;
```

| Parameter                   | Description                       |
| --------------------------- | --------------------------------- |
| `address _newGardenFactory` | Address of the new garden factory |

### EditGardenNFT

*Only governance or multisig can call this function.*

This function edits the address of the garden NFT template contract.

```
function editGardenNFT(address _newGardenNFT) external;
```

| Parameter               | Description                                     |
| ----------------------- | ----------------------------------------------- |
| `address _newGardenNFT` | Address of the new garden NFT template contract |

### EditStrategyNFT

*Only governance or multisig can call this function.*

This function edits the address of the strategy NFT template contract.

```
function editStrategyNFT(address _newStrategyNFT) external;
```

| Parameter                 | Description                                       |
| ------------------------- | ------------------------------------------------- |
| `address _newStrategyNFT` | Address of the new strategy NFT template contract |

### EditStrategyFactory

*Only governance or multisig can call this function.*

This function edits the address of the strategy factory template contract.

```
function editStrategyFactory(address _newStrategyFactory) external;
```

| Parameter                     | Description                                       |
| ----------------------------- | ------------------------------------------------- |
| `address _newStrategyFactory` | Address of the new strategy NFT template contract |

### SetOperation

*Only governance or multi-sig can call this function.*

This function edits an existing operation in the registry.&#x20;

```
function setOperation(uint8 _kind, address _operation) external;
```

| Parameter            | Description                               |
| -------------------- | ----------------------------------------- |
| `uint8 _kind`        | Operation kind.                           |
| `address _operation` | Address of the operation contract to set. |

### SetMasterSwapper

*Only governance or multi-sig can call this function.*

This function allows governance to edit the protocol default trade integration

```
function setMasterSwapper(address _newMasterSwapper) external;
```

### AddKeeper

*Only governance or multi-sig can call this function.*

This function adds a new valid keeper to the list.

```
function addKeeper(address _keeper) external;
```

### AddKeepers

*Only governance or multi-sig can call this function.*

This function adds an array of new valid keepers to the list.

```
function addKeepers(address[] memory _keepers) external;
```

### RemoveKeeper

*Only governance or multi-sig can call this function.*

This function remove a keeper from the keeper's list.

```
function removeKeeper(address _keeper) external;
```

### EnableGardenTokensTransfers

*Only governance can call this function.*

This function allows transfers of ERC20 gardenTokens.

```
function enableGardenTokensTransfers() external;
```

### EditLiquidityReserve

*Only governance can call this function.*

This function edits the minimum liquidity an asset must have on Uniswap.

```
function editLiquidityReserve(address _reserve, uint256 _minRiskyPairLiquidityEth) external;
```

### PatchIntegration

*Only governance or multi-sig can call this function.*

This function replaces old integration with a new one for all the strategies using this integration.

```
function patchIntegration(address _old, address _new) external;
```

### SetPauseGuardian

*Only governance or current pause guardian can call this function.*

This function

Other privileged internal functions are:

```








function setPauseGuardian(address _guardian) external;

function setGlobalPause(bool _state) external returns (bool);

function setSomePause(address[] memory _address, bool _state) external returns (bool);
```

## View Functions

The following functions can be called by anyone without a transaction to retrieve information from the controller.

```
function gardenCreationIsOpen() external view returns (bool);

function owner() external view returns (address);

function EMERGENCY_OWNER() external view returns (address);

function guardianGlobalPaused() external view returns (bool);

function guardianPaused(address _address) external view returns (bool);

function isPaused(address _contract) external view returns (bool);

function priceOracle() external view returns (address);

function gardenValuer() external view returns (address);

function heart() external view returns (address);

function gardenNFT() external view returns (address);

function strategyNFT() external view returns (address);

function rewardsDistributor() external view returns (address);

function gardenFactory() external view returns (address);

function treasury() external view returns (address);

function ishtarGate() external view returns (address);

function mardukGate() external view returns (address);

function strategyFactory() external view returns (address);

function masterSwapper() external view returns (address);

function gardenTokensTransfersEnabled() external view returns (bool);

function bablMiningProgramEnabled() external view returns (bool);

function allowPublicGardens() external view returns (bool);

function enabledOperations(uint256 _kind) external view returns (address);

function getGardens() external view returns (address[] memory);

function getReserveAssets() external view returns (address[] memory);

function getOperations() external view returns (address[20] memory);

function isGarden(address _garden) external view returns (bool);

function protocolWantedAssets(address _wantedAsset) external view returns (bool);

function gardenAffiliateRates(address _wantedAsset) external view returns (uint256);

function affiliateRewards(address _user) external view returns (uint256);

function patchedIntegrations(address _integration) external view returns (address);

function isValidReserveAsset(address _reserveAsset) external view returns (bool);

function isValidKeeper(address _keeper) external view returns (bool);

function isSystemContract(address _contractAddress) external view returns (bool);

function protocolPerformanceFee() external view returns (uint256);

function protocolManagementFee() external view returns (uint256);

function minLiquidityPerReserve(address _reserve) external view returns (uint256);
```


# Garden

Interface: [IGarden.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/interfaces/IGarden.sol)

## ERC-20 Functions

Gardens are fully composable (ERC-20). That means all the ERC-20 functions are available.

You can see all of them [here](https://github.com/OpenZeppelin/openzeppelin-contracts/blob/master/contracts/token/ERC20/ERC20.sol).

## Functions

The following functions can be called by public roles.

### Deposit

*Anyone can call this function for public gardens. In case of private gardens the user requires specific permissions to deposit.*

This function allow a user to deposit the `_amountIn` of reserve asset into the garden.&#x20;

```
  function deposit(
        uint256 _amountIn,
        uint256 _minAmountOut,
        address _to,
        address _referrer
    ) external payable;    
```

| Parameter               | Description                                               |
| ----------------------- | --------------------------------------------------------- |
| `uint256 _amountIn`     | Amount of the reserve asset to deposit by the contributor |
| `uint256 _minAmountOut` | Min amount of Garden shares to receive by contributor     |
| `address _to`           | Address to mint Garden shares to                          |
| `address _referrer`     | The user that referred the deposit                        |

### Withdraw

*Only garden members: Any garden member can call this function.*

This function withdraws the reserve asset based on the garden tokens passed as `_amountIn` in the garden and sends it back to the `_to` address.&#x20;

```
 function withdraw(
        uint256 _amountIn,
        uint256 _minAmountOut,
        address payable _to,
        bool _withPenalty,
        address _unwindStrategy
    ) external;   
```

| Parameter                 | Description                                                     |
| ------------------------- | --------------------------------------------------------------- |
| `uint256 _amountIn`       | Quantity of the garden token to withdraw                        |
| `uint256 _minAmountOut`   | Min quantity of reserve asset to receive                        |
| `address payable _to`     | Address to send component assets to                             |
| `bool _withPenalty`       | Whether or not this is a withdrawal that triggers a liquidation |
| `address _unwindStrategy` | Strategy to unwind if any. Zero address otherwise               |

### ClaimReturns

*Only garden members: Any garden member can call this function.*

This function allows a user to claim the rewards from the strategies that were active while the user was a member of the garden.&#x20;

```
function claimReturns(address[] calldata _finalizedStrategies) external;    
```

| Parameter                                 | Description                                         |
| ----------------------------------------- | --------------------------------------------------- |
| `address[] calldata _finalizedStrategies` | Array of finalized strategies to claim rewards from |

{% hint style="info" %}
It must include all finalized strategies since the last claim.
{% endhint %}

### ClaimAndStakeReturns

*Only garden members: Any garden member can call this function.*

This function allows a user to claim the rewards from the strategies that executed while a member of the garden and stakes these rewards into the Heart Garden.

```
function claimAndStakeReturns(uint256 _minAmountOut, address[] calldata _finalizedStrategies) external;    
```

| Parameter                                 | Description                                                   |
| ----------------------------------------- | ------------------------------------------------------------- |
| `uint256 _minAmountOut`                   | Min quantity of Heart Garden tokens (hBABL) to receive        |
| `address[] calldata _finalizedStrategies` | Array of finalized strategies to claim and stake rewards from |

### ClaimNFT

*Any garden member can call this function.*

This function allows any garden member to claim a garden NFT.

```
    function claimNFT() external;
```

### MakeGardenPublic

*Only a garden creator can call this function.*

The function makes public a previously private garden.

```
function makeGardenPublic() external;
```

### TransferCreatorRights

*Only a garden creator can call this function.*

The function allows a garden creator to transfer his creator rights to another account. The original creator can also renounce its creator role by assigning it to address(0) in public gardens.

```
function transferCreatorRights(address _newCreator, uint8 _index) external;    
```

| Parameter             | Description                                                          |
| --------------------- | -------------------------------------------------------------------- |
| `address _newCreator` | New creator address                                                  |
| `uint8 _index`        | Index of the extra creator in the array of 4 extra-creators (if any) |

### AddExtraCreators

*Only the original garden creator can call this function.*

The function adds extra creators. Can only be called if all the addresses in the extra-creators array are zero (0x).   &#x20;

```
function addExtraCreators(address[4] memory _newCreators) external;
```

| Parameter                        | Description                         |
| -------------------------------- | ----------------------------------- |
| address\[4] memory \_newCreators | Addresses of the new extra creators |

### ResetHardlock

*Only a garden creator can call this function.*

This function allows the creator to reset the garden hardlock for all users.

```
function resetHardlock(uint256 _hardlockStartsAt) external;
```

| Parameter                   | Description                              |
| --------------------------- | ---------------------------------------- |
| `uint256 _hardlockStartsAt` | New global hardlock starts at timestamp. |

### UpdateCreators

*Only Governance or team multi-sig can call this function.*

The function can update garden owners (original owner and extra creators) only if the original creator renounced (creator == address(0)). &#x20;

```
function updateCreators(address _newCreator, address[4] memory _newCreators) external;
```

| Parameter                        | Description                         |
| -------------------------------- | ----------------------------------- |
| `address _newCreator`            | New creator address                 |
| `address[4] memory _newCreators` | Addresses of the new extra creators |

### SetPublicRights

*Only a garden creator can call this function.*

The function gives the right to create strategies and/or voting power to garden users in a public garden.

```
function setPublicRights(bool _publicStrategist, bool _publicStewards) external;
```

| Parameter                | Description                                                              |
| ------------------------ | ------------------------------------------------------------------------ |
| `bool _publicStrategist` | Whether or not all garden members will get be able to suggest strategies |
| `bool _publicStewards`   | Whether or not all garden members will be able to vote on proposals      |

### DelegateVotes

*Only a garden creator can call this function.*

The function allows a garden holding a governance token to delegate its voting power into a delegatee.

```
function delegateVotes(address _token, address _delegatee) external;
```

| Parameter            | Description                                                     |
| -------------------- | --------------------------------------------------------------- |
| `address _token`     | Address of BABL or any other ERC20Comp related governance token |
| `address _delegatee` | Address to delegate token voting power into                     |

### UpdateGardenParams

*Only a garden creator can call this function.*

The function updates relevant garden params.

```
function updateGardenParams(uint256[12] memory _newParams) external;
```

| Parameter                       | Description            |
| ------------------------------- | ---------------------- |
| `uint256[12] memory _newParams` | New params. See below. |

Definition of the garden parameters:

```
_newParams[0...11] are described in order:

 * @param _maxDepositLimit             Max deposit limit in reserve asset units
 * @param _minLiquidityAsset           Number that represents min amount of liquidity denominated in reserve asset
 * @param _depositHardlock             Number that represents the time deposits are locked for
 *                                     an user after the deposit. In seconds.
 * @param _minContribution             Min contribution to the garden in reserve asset units
 * @param _strategyCooldownPeriod      How long after the strategy has been activated, will it be ready
 *                                     to be executed. In seconds.
 * @param _minVotesQuorum              Percentage of votes needed to activate an strategy (0.01% = 1e14, 1% = 1e16)
 * @param _minStrategyDuration         Min duration of an strategy. In seconds.
 * @param _maxStrategyDuration         Max duration of an strategy. In seconds.
 * @param _minVoters                   The minimum amount of voters needed for quorum.
 * @param _pricePerShareDecayRate      Decay rate of price per share. 1e18= 100%
 * @param _pricePerShareDelta          Base slippage for price per share. 1e18= 100%
 * @param _canMintNftAfter             Can mint NFT after being a member for X secs.
 
```

### AddStrategy

*Only a strategist of a garden can call this function.*

This function creates a new strategy calling the factory and adds it to the array.

```
function addStrategy(
        string memory _name,
        string memory _symbol,
        uint256[] calldata _stratParams,
        uint8[] calldata _opTypes,
        address[] calldata _opIntegrations,
        bytes calldata _opEncodedDatas
) external;
```

| Parameter                            | Description                                                          |
| ------------------------------------ | -------------------------------------------------------------------- |
| `string memory _name`                | Name of the strategy                                                 |
| `string memory _symbol`              | Symbol of the strategy                                               |
| `uint256[] calldata _stratParams`    | Num params for the strategy                                          |
| `uint8[] callData _opTypes`          | Type for every operation in the strategy                             |
| `address[] calldata _opIntegrations` | Integrations to pass for each operation in order. One per operation. |
| `bytes calldata _opEncodedDatas`     | 64 bytes of operations metadata per operation (size of 64 \* numOps) |

Definition of the strategy parameters:

```
_stratParams[0]: maxCapitalRequested
_stratParams[1]: stake, 
_stratParams[2]: duration,
_stratParams[3]: expectedReturn,
_stratParams[4]: maxPercentAllocation,
_stratParams[5]: maxGasFeePercentage,
_stratParams[6]: maxSlippagePercentage,    
```

Definition of operation types (opTypes):

```
// 0 = BuyOperation
// 1 = LiquidityOperation
// 2 = VaultOperation
// 3 = LendOperation
// 4 = BorrowOperation
// 5 = CustomOperation
```

Integration addresses can be found in the [deployments](/developers/deployments) section.

### ExpireCandidateStrategy

*Only the strategist can call this function.*

The function removes an expired candidate strategy from the strategy array.

```
function expireCandidateStrategy() external;
```

## Privileged Functions

The following functions can only be executed by protocol privileged roles.

### FinalizeStrategy

*Only a strategy can call this function.*

When the strategy ends, this function saves returns and rewards, and marks the strategy as finalized.

```
function finalizeStrategy(
    uint256 _rewards,
    int256 _returns,
    uint256 _burningAmount
) external;
```

| Parameter                | Description                                                                             |
| ------------------------ | --------------------------------------------------------------------------------------- |
| `uint256 _rewards`       | Amount of Reserve Asset profits to set aside for strategist and stewards roles (if any) |
| `int256 _returns`        | Strategy returns. It can include profits or losses.                                     |
| `uint256 _burningAmount` | The amount of strategist stake to burn in case of strategy losses.                      |

### AllocateCapitalToStrategy

*Only a strategy can call this function.*

This function allocates garden capital to a strategy.

```
function allocateCapitalToStrategy(uint256 _capital) external;
```

| Parameter          | Description                                    |
| ------------------ | ---------------------------------------------- |
| `uint256 _capital` | Amount of capital to allocate to the strategy. |

### PayKeeper

*Only the garden or a strategy can call this function.*

*The function p*ays gas costs back to the keeper from executing transactions including any past debt.

```
function payKeeper(address payable _keeper, uint256 _fee) external;
```

| Parameter                 | Description                                       |
| ------------------------- | ------------------------------------------------- |
| `address payable _keeper` | Keeper that executed the transaction              |
| `uint256 _fee`            | The fee paid to keeper to compensate the gas cost |

### VerifyGarden

*Only governance or team multi-sig can call this function.*

This function can mark a garden as verified.

```
function verifyGarden(uint256 _verifiedCategory) external;
```

| Parameter                   | Description                                                                                            |
| --------------------------- | ------------------------------------------------------------------------------------------------------ |
| `uint256 _verifiedCategory` | 1 for verified gardens, 0 otherwise. Additional categories will use different numbering in the future. |

### DepositBySig

*Only the protocol Keeper can call this function.*

This function allows the user to deposit into a garden by using [signature-based gas-less transactions (meta-tx)](https://medium.com/babylon-finance/introducing-gasless-deposits-51e2d31ccd3f).

```
  function depositBySig(
        uint256 _amountIn,
        uint256 _minAmountOut,
        uint256 _nonce,
        uint256 _maxFee,
        address _to,
        uint256 _pricePerShare,
        uint256 _fee,
        address _signer,
        address _referrer,
        bytes memory signature
   ) external;
```

| Parameter                 | Description                                                                                                                                                                                               |
| ------------------------- | --------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
| `uint256 _amountIn`       | Amount of the reserve asset that is received from contributor.                                                                                                                                            |
| `uint256 _minAmountOut`   | Min amount of Garden shares to receive by contributor.                                                                                                                                                    |
| `uint256 _nonce`          | Current nonce to prevent replay attacks.                                                                                                                                                                  |
| `uint256 _maxFee`         | Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount unless it is subsidized totally or partially by the garden or treasury. Fee is expressed in reserve asset. |
| `uint256 _to`             | Address to mint shares to.                                                                                                                                                                                |
| `uint256 _pricePerShare`  | Price per share of the garden calculated off-chain by Keeper.                                                                                                                                             |
| `uint256 _fee`            | Actual fee keeper demands. Have to be less than \_maxFee.                                                                                                                                                 |
| `address _signer`         | The user to who signed the signature.                                                                                                                                                                     |
| `address _referrer`       | The user that referred the deposit.                                                                                                                                                                       |
| `bytes memory _signature` | Signature by the user to verify deposit params                                                                                                                                                            |

### WithdrawBySig

*Only the protocol Keeper can call this function.*

This function allows the user to withdraw from a garden by using [signature based gas-less transaction (meta-tx)](https://medium.com/babylon-finance/introducing-gasless-deposits-51e2d31ccd3f).

```
function withdrawBySig(
        uint256 _amountIn,
        uint256 _minAmountOut,
        uint256 _nonce,
        uint256 _maxFee,
        bool _withPenalty,
        address _unwindStrategy,
        uint256 _pricePerShare,
        uint256 _strategyNAV,
        uint256 _fee,
        address _signer,
        bytes memory signature
 ) external;
```

| Parameter                 | Description                                                                                                             |
| ------------------------- | ----------------------------------------------------------------------------------------------------------------------- |
| `uint256 _amountIn`       | Quantity of the garden tokens to withdraw.                                                                              |
| `uint256 _minAmountOut`   | Min quantity of reserve asset to receive.                                                                               |
| `uint256 _nonce`          | Current nonce to prevent replay attacks.                                                                                |
| `uint256 _maxFee`         | Max fee user is willing to pay keeper. Fee is substracted from the withdrawn amount. Fee is expressed in reserve asset. |
| `bool _withPenalty`       | Whether or not this is an immediate withdrawal.                                                                         |
| `address _unwindStrategy` | Strategy to unwind (if any)                                                                                             |
| `uint256 _pricePerShare`  | Price per share of the garden calculated off-chain by Keeper.                                                           |
| `uint256 _strategyNAV`    | NAV of the strategy to unwind                                                                                           |
| `uint256 _fee`            | Actual fee keeper demands. Have to be less than \_maxFee.                                                               |
| `address _signer`         | The user to who signed the signature.                                                                                   |
| `bytes memory _signature` | Signature by the user to verify deposit params                                                                          |

### ClaimRewardsBySig

*Only the protocol Keeper can call this function.*

This function allows the user to claim their rewards of a garden by using [signature based gas-less transaction (meta-tx)](https://medium.com/babylon-finance/introducing-gasless-deposits-51e2d31ccd3f).

```
function claimRewardsBySig(
        uint256 _babl,
        uint256 _profits,
        uint256 _nonce,
        uint256 _maxFee,
        uint256 _fee,
        address _signer,
        bytes memory _signature
) external;
```

| Parameter                 | Description                                                                                                                        |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `uint256 _babl`           | BABL rewards from mining program.                                                                                                  |
| `uint256 _profits`        | Profit rewards in reserve asset.                                                                                                   |
| `uint256 _nonce`          | Current nonce to prevent replay attacks.                                                                                           |
| `uint256 _maxFee`         | Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset. |
| `uint256 _fee`            | Actual fee keeper demands. Have to be less than \_maxFee.                                                                          |
| `address _signer`         | The user who signed the signature.                                                                                                 |
| `bytes memory _signature` | Signature by the user to verify claim params.                                                                                      |

### ClaimAndStakeRewardsBySig

*Only the protocol Keeper can call this function.*

This function allows the user to claim their rewards of a garden and stake all BABL rewards into the Heart Garden by using [signature based gas-less transaction (meta-tx)](https://medium.com/babylon-finance/introducing-gasless-deposits-51e2d31ccd3f).

```
function claimAndStakeRewardsBySig(
        uint256 _babl,
        uint256 _profits,
        uint256 _minAmountOut,
        uint256 _nonce,
        uint256 _nonceHeart,
        uint256 _maxFee,
        uint256 _pricePerShare,
        uint256 _fee,
        address _signer,
        bytes memory _signature
) external;
```

| Parameter                 | Description                                                                                                                        |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `uint256 _babl`           | BABL rewards from mining program.                                                                                                  |
| `uint256 _profits`        | Profit rewards in reserve asset.                                                                                                   |
| `uint256 _minAmountOut`   | Minimum hBABL as part of the Heart Garden BABL staking.                                                                            |
| `uint256 _nonce`          | Current nonce of user in the claiming garden at to prevent replay attacks.                                                         |
| `uint256 _nonceHeart`     | Current nonce of user in Heart Garden to prevent replay attacks.                                                                   |
| `uint256 _maxFee`         | Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset. |
| `uint256 _fee`            | Actual fee keeper demands. Have to be less than \_maxFee.                                                                          |
| `uint256 _pricePerShare`  | Price per share of Heart Garden.                                                                                                   |
| `address _signer`         | The user who signed the signature.                                                                                                 |
| `bytes memory _signature` | Signature by the user to verify claim and stake params.                                                                            |

### StakeBySig

*Only a garden can call this function.*

This function allows a garden to stake user BABL rewards on behalf of the user into the Heart Garden by using [signature based gas-less transaction (meta-tx)](https://medium.com/babylon-finance/introducing-gasless-deposits-51e2d31ccd3f) as well as [EIP-1271.](https://eips.ethereum.org/EIPS/eip-1271)

```
function stakeBySig(
        uint256 _amountIn,
        uint256 _profits,
        uint256 _minAmountOut,
        uint256 _nonce,
        uint256 _nonceHeart,
        uint256 _maxFee,
        address _to,
        uint256 _pricePerShare,
        address _signer,
        bytes memory _signature
) external;
```

| Parameter                 | Description                                                                                                                        |
| ------------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| `uint256 _amountIn`       | Amount of BABL that is going to be staked by contributor                                                                           |
| `uint256 _profits`        | Profit rewards in reserve asset.                                                                                                   |
| `uint256 _minAmountOut`   | Minimum hBABL as part of the Heart Garden BABL staking.                                                                            |
| `uint256 _nonce`          | Current nonce of user in the claiming garden at to prevent replay attacks.                                                         |
| `uint256 _nonceHeart`     | Current nonce in heart garden to prevent replay attacks.                                                                           |
| `uint256 _maxFee`         | Max fee user is willing to pay keeper. Fee is substracted from the user wallet approved amount. Fee is expressed in reserve asset. |
| `address _to`             | Address to mint shares to.                                                                                                         |
| `uint256 _pricePerShare`  | Price per share of the garden calculated off-chain by Keeper.                                                                      |
| `address _signer`         | The garden who signed the stake operation using EIP-1271.                                                                          |
| `bytes memory _signature` | Signature by the user to verify claim and stake params.                                                                            |

## View Functions

The following functions can be called by anyone without a transaction to retrieve information from the garden.

### PrivateGarden

Function to check if the garden is private (true) or public (false).

```
function privateGarden() external view returns (bool);
```

### PublicStrategist

Function to check if all garden members have strategist role (true means that all garden members have strategist role).

```
function publicStrategists() external view returns (bool);
```

### PublicStewards

Function to check if all garden members have voting privileges (true means all garden members can vote).

```
function publicStewards() external view returns (bool);
```

### Controller

Function to retrieve the controller smart-contract address.

```
function controller() external view returns (IBabController);
```

### Creator

Function to retrieve the garden original creator address.

```
function creator() external view returns (address);
```

### IsGardenStrategy

Function to check whether or not the strategy belongs to the garden (true or false).

```
function isGardenStrategy(address _strategy) external view returns (bool);
```

### GetContributor

Function to retrieve contributor information.

```
function getContributor(address _contributor)
        external
        view
        returns (
            uint256 lastDepositAt,
            uint256 initialDepositAt,
            uint256 claimedAt,
            uint256 claimedBABL,
            uint256 claimedRewards,
            uint256 withdrawnSince,
            uint256 totalDeposits,
            uint256 nonce,
            uint256 lockedBalance
);
```

| Parameter                  | Description                               |
| -------------------------- | ----------------------------------------- |
| `address _contributor`     | Garden member address                     |
| `uint256 lastDepositAt`    | Timestamp of the last deposit             |
| `uint256 initialDepositAt` | Timestamp of the initial deposit          |
| `uint256 claimedAt`        | Timestamp of the last claim               |
| `uint256 claimedBABL`      | Total amount of claimed BABL              |
| `uint256 claimedRewards`   | Total amount of claimed rewards           |
| `uint256 withdrawnSince`   | Total amount of withdrawals               |
| `uint256 totalDeposits`    | Total amount of deposits                  |
| `uint256 nonce`            | Contributor nonce to avoid replay attacks |
| `uint256 lockedBalance`    | Locked balance of the contributor         |

### ReserveAsset

Function to get the address of the garden reserveAsset.

```
function reserveAsset() external view returns (address);
```

### VerifiedCategory

Function to get whether or not governance has verified the garden and the category.

```
function verifiedCategory() external view returns (uint256);
```

### HardlockStartsAt

Function to get the timestamp that overrides the `depositLock` with a global hard lock.

```
function hardlockStartsAt() external view returns (uint256);
```

### CanMintNftAfter

Function to get the delay required (in seconds) before a garden member can mint a garden NFT since its initial deposit.&#x20;

```
function canMintNftAfter() external view returns (uint256);
```

### TotalContributors

Function to get the total number of contributors in the garden.

```
function totalContributors() external view returns (uint256);
```

### GardenInitializedAt

Function to get the timestamp of the garden creation.

```
function gardenInitializedAt() external view returns (uint256);
```

### MinContribution

Function to get the minimum contribution amount required by the garden.

```
function minContribution() external view returns (uint256);
```

### DepositHardlock

Function to get the minimum required delay (in seconds) between a deposit and a withdrawal (i.e. 1 second to avoid flashloans).

```
function depositHardlock() external view returns (uint256);
```

### MinLiquidityAsset

Function to get the minimum liquidity required for an asset to be tradable by this garden.

```
function minLiquidityAsset() external view returns (uint256);
```

### MinStrategyDuration

Function to get the minimum strategy duration (in seconds).

```
function minStrategyDuration() external view returns (uint256);
```

### MaxStrategyDuration

Function to get the maximum strategy duration (in seconds).

```
function maxStrategyDuration() external view returns (uint256);
```

### ReserveAssetRewardsSetAside

Function to get the number of profits denominated in the reserve asset that are set aside (reserved) for strategies and voters. LP profit rewards are auto-compounded.&#x20;

```
function reserveAssetRewardsSetAside() external view returns (uint256);
```

### AbsoluteReturns

Function to get the garden absolute returns value.

```
function absoluteReturns() external view returns (int256);
```

### TotalStake

Function to get the total stake from strategists in all the strategies.

```
function totalStake() external view returns (uint256);
```

### MinVotesQuorum

Function to get the minimum quorum (1e18 = 100%) needed to approve and execute a strategy.

```
function minVotesQuorum() external view returns (uint256);
```

### MinVoters

Function to get the minimum voters to approve and execute a strategy.

```
function minVoters() external view returns (uint256);
```

### MaxDepositLimit

function to get the maximum deposit limit of a garden.

```
function maxDepositLimit() external view returns (uint256);
```

### StrategyCooldownPeriod

Function to get how long the strategy will wait in seconds to execute after being approved.

```
function strategyCooldownPeriod() external view returns (uint256);
```

### GetStrategies

Function to get an array of current strategies.

```
function getStrategies() external view returns (address[] memory);
```

### ExtraCreators

Function to get the address of an extra creator within the array of extraCreators. As param, it needs the index from 0 to 3 as there is a maximum of 4 extra creators.

```
function extraCreators(uint256 index) external view returns (address);
```

### GetFinalizedStrategies

Function to get an array of all finalized strategies.

```
function getFinalizedStrategies() external view returns (address[] memory);
```

### StrategyMapping

Function to check all active strategies in the garden.

```
function strategyMapping(address _strategy) external view returns (bool);
```

### KeeperDebt

Function to get current debt to be paid to the Keeper.

```
function keeperDebt() external view returns (uint256);
```

### TotalKeeperFees

Function to get the total fees paid to Keeper.

```
function totalKeeperFees() external view returns (uint256);
```

### LastPricePerShare

Function to get the last recorded price per share of the garden during deposit or withdrawal operation.

```
function lastPricePerShare() external view returns (uint256);
```

### LastPricePerShareTS

Function to get the last recorded time of the deposit or withdraw in seconds.

```
function lastPricePerShareTS() external view returns (uint256);
```

### PricePerShareDecayRate

Function to get the decay rate of the slippage for pricePerShare over time.

```
function pricePerShareDecayRate() external view returns (uint256);
```

### PricePerShareDelta

Function to get the base slippage for pricePerShare of the garden.

```
function pricePerShareDelta() external view returns (uint256);
```

### Name

Function to get the name of the garden token.

```
function name() external view returns (string memory);
```


# Strategy

Interface: [IStrategy.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/interfaces/IStrategy.sol)

## Functions

The following functions can be called by any user or public roles.

### Sweep

*Public: Anyone can call this function.*

This function converts any token sent to the strategy into the reserve asset and sends it to the garden.

```
function sweep(address _token, uint256 _newSlippage) external;
```

{% hint style="info" %}
The strategy must be inactive
{% endhint %}

| Parameter              | Description                   |
| ---------------------- | ----------------------------- |
| `address _token`       | Address of the token to sweep |
| `uint256 _newSlippage` | Overrides slippage setting    |

### UpdateParams

*Only the Strategist can call this function*

This function updates specific strategy parameters.

```
function updateParams(uint256[5] calldata _params) external;
```

<table><thead><tr><th width="370">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><pre><code>uint256[5] calldata _params
</code></pre></td><td>Array of 5 parameters. See below.</td></tr></tbody></table>

Definition of strategy parameters:

```
*   _params[0]  duration                    Strategy duration in seconds
*   _params[1]  maxGasFeePercentage         Max gas fee % capped to 10e16
*   _params[2]  maxTradeSlippagePercentage  Max trading slippage % capped to 20e16
*   _params[3]  maxAllocationPercentage     Max garden capital allocation % (<= 1e18)
*   _params[4]  maxCapitalRequested         Max capital requested in reserveAsset
```

{% hint style="info" %}
New duration value must be equal or less than the original duration.&#x20;
{% endhint %}

### DeleteCandidateStrategy

*Only the Strategist can call this function*

This function deletes a candidate strategy.

```
function deleteCandidateStrategy() external;
```

## Privileged Functions

The following functions can only be executed by protocol privileged roles.

### ResolveVoting

*Only the protocol Keeper can call this function*

This function adds off-chain gas-less voting results on-chain.

```
function resolveVoting(
    address[] calldata _voters,
    int256[] calldata _votes,
    uint256 _fee
) external;
```

| Parameters                   | Description                                        |
| ---------------------------- | -------------------------------------------------- |
| `address[] calldata _voters` | An array of garden member who voted on strategy    |
| `int256[] calldata _votes`   | An array of votes by on strategy by garden members |
| `uint256 _fee`               | The fee paid to keeper to compensate the gas cost  |

### ExecuteStrategy

*Only the protocol Keeper can call this function*

This function executes a strategy that has been activated and gone through the cooldown period.

```
function executeStrategy(uint256 _capital, uint256 _fee) external;
```

| Parameter          | Description                                       |
| ------------------ | ------------------------------------------------- |
| `uint256 _capital` | The capital to allocate to this strategy          |
| `uint256 _fee`     | The fee paid to keeper to compensate the gas cost |

### FinalizeStrategy

*Only the protocol Keeper can call this function*

This function exits from an executed strategy. Returns balance back to the garden and sets the capital aside for withdrawals in ETH. Pays the keeper and updates the reserve asset position accordingly.

```
function finalizeStrategy(
    uint256 _fee,
    string memory _tokenURI,
    uint256 _minReserveOut
) external;
```

| Parameter                 | Description                                                       |
| ------------------------- | ----------------------------------------------------------------- |
| `uint256 _fee`            | The fee paid to keeper to compensate the gas cost                 |
| `string memory _tokenURI` | URL with the JSON for the strategy to grant NFT to the strategist |
| `uint256 _minReserveOut`  | Minimum reserve asset to get during strategy finalization         |

### UnwindStrategy

*Only the protocol Keeper can call this function*

This function partially unwinds a strategy. Triggered from a penalty withdrawal in the Garden.

```
function unwindStrategy(uint256 _amountToUnwind, uint256 _strategyNAV) external;
```

| Parameter                 | Description                     |
| ------------------------- | ------------------------------- |
| `uint256 _amountToUnwind` | The amount of capital to unwind |
| `uint256 _strategyNAV`    | NAV of the strategy to unwind   |

### ExpireStrategy

*Only the protocol Keeper can call this function*

This function expires a candidate that has spent more than `CANDIDATE_PERIOD` seconds without reaching quorum.

```
function expireStrategy(uint256 _fee) external;
```

| Parameter      | Description    |
| -------------- | -------------- |
| `uint256 _fee` | The keeper fee |

### SetData

*Only the garden can call this function*

Sets the data for the operations of this strategy.

```
function setData(
    uint8[] calldata _opTypes,
    address[] calldata _opIntegrations,
    bytes memory _opEncodedData
) external;
```

<table><thead><tr><th width="383.6759775138188">Parameter</th><th>Description</th></tr></thead><tbody><tr><td><code>uint8[] calldata _opTypes</code></td><td>An array with the op types</td></tr><tr><td><code>address[] calldata _opIntegrations</code></td><td>Addresses with the integration for each op</td></tr><tr><td><code>bytes memory _opEncodedData</code></td><td>64 bytes of operations metadata per operation (size of 64 * numOps)</td></tr></tbody></table>

Definition of types of operations:

```
// 0 = BuyOperation
// 1 = LiquidityOperation
// 2 = VaultOperation
// 3 = LendOperation
// 4 = BorrowOperation
```

### Trade

*Only a valid operation can call this function*

Function that calculates the price using the oracle and executes a trade. Must call the exchange to get the price and pass minReceiveQuantity accordingly.

```
function trade(
    address _sendToken,
    uint256 _sendQuantity,
    address _receiveToken
) external returns (uint256);

function trade(
    address _sendToken,
    uint256 _sendQuantity,
    address _receiveToken,
    uint256 _overrideSlippage
) external returns (uint256);
```

| Parameter                   | Description                   |
| --------------------------- | ----------------------------- |
| `address _sendToken`        | Token to exchange             |
| `uint256 _sendQuantity`     | Amount of tokens to send      |
| `address _receiveToken`     | Token to receive              |
| `uint256 _overrideSlippage` | Slippage to override (if any) |

### HandleWeth

*Only a valid operation can call this function*

Function that deposits or withdraws WETH from an operation in this context.

```
function handleWeth(bool _isDeposit, uint256 _wethAmount) external;
```

| Parameter             | Description                      |
| --------------------- | -------------------------------- |
| `bool _isDeposit`     | Whether is a deposit or withdraw |
| `uint256 _wethAmount` | Amount to deposit or withdraw    |

### InvokeFromIntegration

*Only a valid integration can call this function*

Helper to invoke a call to an external contract from integrations in the strategy context.

```
function invokeFromIntegration(
    address _target,
    uint256 _value,
    bytes calldata _data
) external returns (bytes memory);
```

| Parameter              | Description                                         |
| ---------------------- | --------------------------------------------------- |
| `address _target`      | Address of the smart contract to call               |
| `uint256 _value`       | Quantity of Ether to provide the call (typically 0) |
| `bytes calldata _data` | Encoded function selector and arguments             |
| `return value`         | Bytes encoded return value                          |

### InvokeApprove

*Only a valid integration can call this function*

Helper to invoke Approve on ERC20 from integrations in the strategy context.

```
function invokeApprove(
    address _spender,
    address _asset,
    uint256 _quantity
) external;
```

| Parameter           | Description                   |
| ------------------- | ----------------------------- |
| `address _spender`  | Spender address to be allowed |
| `address _asset`    | Asset address                 |
| `uint256 _quantity` | Amount to approve             |

## View functions

The following functions can be called by anyone without a transaction to retrieve information from the strategy.

### GetNAV

Function to get the strategy Net Asset Value (NAV) in reserveAsset.

```
function getNAV() external view returns (uint256);
```

### OpEncodedData

Function to get encoded operation data (in bytes) where each consecutive 64 bytes are reserved for each operation metadata. Metadata is usually including operation addresses and values needed for those operations.

```
function opEncodedData() external view returns (bytes memory);
```

### GetOperationsCount

Function to get the number of operations used by the strategy.

```
function getOperationsCount() external view returns (uint256);
```

### GetOperationByIndex

Function to get the operation data by index.&#x20;

```
function getOperationByIndex(uint8 _index)
    external
    view
    returns (
        uint8,
        address,
        bytes memory
);
```

### GetStrategyDetails

Function to get the details of the strategy.

```
function getStrategyDetails()
    external
    view
    returns (
        address garden,
        address strategist,
        uint256 opIntLength,
        uint256 stake,
        uint256 totalPositiveVotes,
        uint256 totalNegativeVotes,
        uint256 capitalAllocated,
        uint256 capitalReturned,
        uint256 duration,
        uint256 expectedReturn,
        uint256 maxCapitalRequested,
        address strategyNFT,
        uint256 enteredAt,
        uint256 nav
    );
```

| Parameter                     | Description                                                         |
| ----------------------------- | ------------------------------------------------------------------- |
| `address garden`              | Garden address                                                      |
| `address strategist`          | Strategist address                                                  |
| `uint256 opIntLength`         | Length of the array of addresses with the integration for each op   |
| `uint256 stake`               | Stake of the strategist in this strategy                            |
| `uint256 totalPositiveVotes`  | Total positive votes for the strategy                               |
| `uint256 totalNegativeVotes`  | Total negative votes for the strategy                               |
| `uint256 capitalAllocated`    | Capital allocated for the strategy in reserveAsset                  |
| `uint256 capitalReturned`     | Capital returned by the strategy after finalization in reserveAsset |
| `uint256 duration`            | Duration of the strategy (in seconds)                               |
| `uint256 expectedReturn`      | Expected positive % profit (i.e. 5%) in 18 decimals precision.      |
| `uint256 maxCapitalRequested` | Amount of max capital to allocate to the strategy                   |
| `address strategyNFT`         | Address of the strategyNFT                                          |
| `uint256 enteredAt`           | Timestamp when the strategy was created                             |
| `uint256 nav`                 | Net Asset Value of the strategy in reserveAsset                     |

### GetStrategyState

Function to get the state of the strategy.

```
function getStrategyState()
    external
    view
    returns (
        address strategy,
        bool active,
        bool dataSet,
        bool finalized,
        uint256 executedAt,
        uint256 exitedAt,
        uint256 updatedAt
    );
```

| Parameter            | Description                                                   |
| -------------------- | ------------------------------------------------------------- |
| `address strategy`   | Address of the strategy                                       |
| `bool active`        | Whether or not the strategy is active                         |
| `bool dataSet`       | Whether or not the strategy data is set                       |
| `bool finalized`     | Whether or not the strategy has finalized                     |
| `uint256 executedAt` | Timestamp of initial execution (0 if still not executed)      |
| `uint256 exitedAt`   | Timestamp of strategy finalization (0 if still not finalized) |
| `uint256 updatedAt`  | Timestamp of last strategy update                             |

### GetStrategyRewardsContext

Function to get all relevant context strategy data required for BABL mining program calculations.

```
function getStrategyRewardsContext()
    external
    view
    returns (
        address strategist,
        uint256[] memory data, 
        bool[] memory boolData
    );
```

| Parameter                | Description                      |
| ------------------------ | -------------------------------- |
| `address strategist`     | Address of the strategist        |
| `uin256[] memory data`   | Context data. See below.         |
| `bool[] memory boolData` | Boolean context data. See below. |

Definition of strategy context data:

```
data[0] Timestamp of when the strategy was executed (executedAt)
data[1] Timestamp of when the strategy was finalized (exitedAt)
data[2] Timestamp of when the strategy was updated (updatedAt)
data[3] Timestamp of when the strategy was created (enteredAt)
data[4] Amount of total positive votes for the strategy
data[5] Amount of total positive votes against the strategy
data[6] Capital allocated to the strategy
data[7] Capital returned by the strategy
data[8] Expected capital returned (considers expected return)
data[9] Strategy Rewards
data[10] Profit amount (if any)
data[11] Amount difference between real return and expected capital returned
data[12] Garden token supply when the strategy was created
data[13] Garden token supply when the strategy was finalized
data[14] Proportional slippage factor vs. total duration
boolData[0] Profits (true) losses (false)
boolData[1] If profits where above expectations (true) or below (false)
```

### IsStrategyActive

Function to check whether or not the strategy is active.

```
function isStrategyActive() external view returns (bool);
```

### GetUserVotes

Function to get specific user votes for a user.

```
function getUserVotes(address _address) external view returns (int256);
```

### Strategist

Function to get the strategist address.

```
function strategist() external view returns (address);
```

### EnteredAt

Function to get the timestamp when the strategy was created.

```
function enteredAt() external view returns (uint256);
```

### EnteredCooldownAt

Function to get the timestamp  when the strategy reached quorum.

Other view functions are the following:

### Stake

Function to get the stake of the strategist in the strategy.

```
function stake() external view returns (uint256);
```

### StrategyRewards

Function to get the assigned strategyRewards from BABL Mining program for the strategy.

```
function strategyRewards() external view returns (uint256);
```

### MaxCapitalRequested

Function to get the max capital requested for the strategy in reserveAsset.

```
function maxCapitalRequested() external view returns (uint256);
```

### MaxAllocationPercentage

Function to get the maximum capital allocation percentage (%).

```
function maxAllocationPercentage() external view returns (uint256);
```

### MaxTradeSlippagePercentage

Function to get the maximum trading slippage in % with 18 decimals precision.

```
function maxTradeSlippagePercentage() external view returns (uint256);
```

### MaxGasFeePercentage

Function to get the maximum gas fee percentage to limit the execution cost for the strategy-keeper.

```
function maxGasFeePercentage() external view returns (uint256);
```

### ExpectedReturn

Function to get the expected return or expected profits in % with 18 decimals precision (i.e. 5% 5e16)

```
function expectedReturn() external view returns (uint256);
```

### Duration

Function to get the duration of the strategy (in seconds).

```
function duration() external view returns (uint256);
```

### TotalPositiveVotes

Function to get the total positive votes of the strategy.

```
function totalPositiveVotes() external view returns (uint256);
```

### TotalNegativeVotes

Function to get the total negative votes of the strategy.

```
function totalNegativeVotes() external view returns (uint256);
```

### CapitalReturned

Function to get the capital returned in reserveAsset.

```
function capitalReturned() external view returns (uint256);
```

### CapitalAllocated

Function to get the capital allocated in reserveAsset.

```
function capitalAllocated() external view returns (uint256);
```

### Garden

Function to get the garden address the strategy belongs to.

```
function garden() external view returns (IGarden);
```


# Custom Integrations

Interface: [ICustomIntegration.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/interfaces/ICustomIntegration.sol)

Base Classes: [CustomIntegration.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/integrations/custom/CustomIntegration.sol) [BaseIntegration.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/integrations/BaseIntegration.sol)

Template: [CustomIntegrationTemplate.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/integrations/custom/CustomIntegrationTemplate.sol)

Example (Yearn): [CustomIntegrationYearn.sol](https://github.com/babylon-finance/core-interfaces/blob/main/contracts/integrations/custom/CustomIntegrationYearn.sol)

## Functions

The following functions can be called by anyone. Strategy operations call it to execute them within its context.

```
function enter(
    address _strategy,
    bytes calldata _data,
    uint256 _resultTokensOut,
    address[] memory _inputTokens,
    uint256[] memory _maxAmountsIn
) external;

function exit(
    address _strategy,
    bytes calldata _data,
    uint256 _resultTokensIn,
    address[] memory _inputTokens,
    uint256[] memory _minAmountsOut
) external;

function isValid(bytes calldata _data) external view returns (bool);

function getInputTokensAndWeights(bytes calldata _data) external view returns (address[] memory, uint256[] memory);

function getResultToken(address _data) external view returns (address);

function getPriceResultToken(bytes calldata _data, address _tokenAddress) external view returns (uint256);

function getOutputTokensAndMinAmountOut(address _strategy, bytes calldata _data, uint256 _resultTokenAmount)
    external
    view
    returns (address[] memory exitTokens, uint256[] memory _minAmountsOut);

function getRewardTokens(bytes calldata _data) external view returns (address[] memory);
```


# Error codes

Babylon error codes include a prefix BAB and a 3 digit number after a hashtag # (i.e. BAB#120).

| BAB# error code | Description                                                    |
| --------------- | -------------------------------------------------------------- |
| 0               | Max deposit limit                                              |
| 1               | Minimum contribution                                           |
| 2               | Minimum token supply                                           |
| 3               | Deposit hardlock                                               |
| 4               | Minimum liquidity                                              |
| 5               | msg.value does not match                                       |
| 6               | msg.sender tokens do not match                                 |
| 7               | Tokens staked                                                  |
| 8               | Balance too low                                                |
| 9               | msg.sender tokens too low                                      |
| 10              | Redemption opened already                                      |
| 11              | Already requested                                              |
| 12              | Already claimed                                                |
| 13              | Value has to be greater than zero                              |
| 14              | Must be reserve asset                                          |
| 15              | Only contributors allowed                                      |
| 16              | Only controller allowed                                        |
| 17              | Only creator allowed                                           |
| 18              | Only keeper allowed                                            |
| 19              | Fee too high                                                   |
| 20              | Only strategy allowed                                          |
| 21              | Only active allowed                                            |
| 22              | Only inactive allowed                                          |
| 23              | Address should not be zero                                     |
| 24              | Not in range                                                   |
| 25              | Value too low                                                  |
| 26              | Value too high                                                 |
| 27              | Only strategy or protocol allowed                              |
| 28              | Normal withdrawal possible                                     |
| 29              | User cannot join                                               |
| 30              | User does not have permission to add strategies in garden      |
| 31              | Only protocol or garden                                        |
| 32              | Only strategist allowed                                        |
| 33              | Only integration allowed                                       |
| 34              | Only garden and data not set                                   |
| 35              | Only active garden                                             |
| 36              | Not a garden                                                   |
| 37              | Strategist tokens too low                                      |
| 38              | Stake is too low                                               |
| 39              | Duration must be in range                                      |
| 40              | (reserved)                                                     |
| 41              | Max capital requested                                          |
| 42              | Votes are already resolved                                     |
| 43              | Voting window is over                                          |
| 44              | Strategy needs to be active                                    |
| 45              | Max capital reached                                            |
| 46              | Capital is less than rebalance                                 |
| 47              | Strategy in cooldown                                           |
| 48              | Strategy is not executed                                       |
| 49              | Strategy is not over yet                                       |
| 50              | Strategy is already finalized or > initial duration            |
| 51              | No capital to unwind                                           |
| 52              | Strategy needs to be inactive                                  |
| 53              | Duration needs to be less                                      |
| 54              | Cannot sweep reserve asset                                     |
| 55              | Voting window is opened                                        |
| 56              | Strategy is executed                                           |
| 57              | Min rebalance capital                                          |
| 58              | Not a valid strategy NFT                                       |
| 59              | Garden transfers disabled                                      |
| 60              | Tokens hardlocked                                              |
| 61              | Max contributors reached                                       |
| 62              | BABL transfers disabled                                        |
| 63              | Strategy duration range error                                  |
| 64              | Min amount of voters                                           |
| 65              | Contributor power check window                                 |
| 66              | Not enough reserve                                             |
| 67              | Garden already public                                          |
| 68              | Withdrawal with penalty                                        |
| 69              | Only mining active                                             |
| 70              | Overflow in supply                                             |
| 71              | Overflow in power                                              |
| 72              | Not a system contract                                          |
| 73              | Strategy garden mismatch                                       |
| 74              | Min quarter                                                    |
| 75              | Too many operations or operations integrations length mismatch |
| 76              | Only operations                                                |
| 77              | Strategy params wrong length                                   |
| 78              | Garden params wrong length                                     |
| 79              | Token names too long                                           |
| 80              | Contributor power overflow                                     |
| 81              | Contributor power window out of bounds                         |
| 82              | No rewards to claim                                            |
| 83              | Only unpaused                                                  |
| 84              | Reentrant intent                                               |
| 85              | Reserve asset not supported                                    |
| 86              | Receive min amount                                             |
| 87              | Total votes has to be positive                                 |
| 88              | Invalid signer                                                 |
| 89              | Invalid nonce                                                  |
| 90              | Garden is not public                                           |
| 91              | Max contributors set                                           |
| 92              | Profit sharing mismatch                                        |
| 93              | Max strategy allocation percentage                             |
| 94              | New creator must not exist                                     |
| 95              | Only first creator can add                                     |
| 96              | Invalid address                                                |
| 97              | Creator cannot renounce                                        |
| 98              | No price for trade                                             |
| 99              | Zero capital requested                                         |
| 100             | Invalid capital to unwind                                      |
| 101             | Invalid mining values                                          |
| 102             | Max trade slippage percentage                                  |
| 103             | Max gas fee percentage                                         |
| 104             | Invalid votes length                                           |
| 105             | Only rewards distributor                                       |
| 106             | Fee too low                                                    |
| 107             | Only governance or emergency                                   |
| 108             | Invalid reserve amount                                         |
| 109             | Heart only pumps once a week                                   |
| 110             | Heart votes missing                                            |
| 111             | Not enough fees for heart                                      |
| 112             | Invalid heart votes length                                     |
| 113             | Heart LP tokens not received                                   |
| 114             | Heart invalid asset to lend                                    |
| 115             | Heart garden not set                                           |
| 116             | Heart asset to lend is the same                                |
| 117             | Heart invalid cToken                                           |
| 118             | Price per share is wrong                                       |
| 119             | Invalid heart asset purchase                                   |
| 120             | Invalid reset hardlock                                         |
| 121             | Invalid referrer                                               |
| 122             | Only heart garden                                              |
| 123             | Max BABL cap reached                                           |
| 124             | Not enough BABL                                                |
| 125             | Claim garden NFT                                               |
| 126             | Not enough collateral                                          |
| 127             | Amount too low                                                 |
| 128             | Amount too high                                                |
| 129             | Slippage too high                                              |
| 130             | Invalid amount                                                 |
| 131             | Not enough amount                                              |
| 132             | Error minting                                                  |


# Deployments

Smart Contracts Deployment addresses

## Mainnet

### Controller & System Contracts

| Contract Name       | Address                                                                                                                    |
| ------------------- | -------------------------------------------------------------------------------------------------------------------------- |
| BABController       | [0xd4a5b5fcb561daf3adf86f8477555b92fba43b5f](https://etherscan.io/address/0xd4a5b5fcb561daf3adf86f8477555b92fba43b5f)      |
| GardenFactory       | [0xf2ae6c67d8f75b8d90a0f5aa2a05f5e05bc528d9](https://etherscan.io/address/0xf2ae6c67d8f75b8d90a0f5aa2a05f5e05bc528d9#code) |
| Ishtar Gate         | [0x77d200eca7fd0a3db27e96d7b24cf7613b0a2a12](https://etherscan.io/address/0x77d200eca7fd0a3db27e96d7b24cf7613b0a2a12)      |
| Marduk Gate         | [0x6504227a2f6c44e951289179de769b8c9898c075](https://etherscan.io/address/0x6504227a2f6c44e951289179de769b8c9898c075)      |
| Rewards Distributor | [0x40154ad8014df019a53440a60ed351dfba47574e](https://etherscan.io/address/0x40154ad8014df019a53440a60ed351dfba47574e)      |

### Token

| Contract Name     | Address                                                                                                               |
| ----------------- | --------------------------------------------------------------------------------------------------------------------- |
| $BABL Token       | [0xf4dc48d260c93ad6a96c5ce563e70ca578987c74](https://etherscan.io/address/0xF4Dc48D260C93ad6a96c5Ce563E70CA578987c74) |
| Timelock Registry | [0x009efacc05539b5d41c1bac30e01832726a3ca3c](https://etherscan.io/address/0x009efacc05539b5d41c1bac30e01832726a3ca3c) |

### Verified Gardens (Investment Clubs)

| Contract Name       | Address                                                                                                               |
| ------------------- | --------------------------------------------------------------------------------------------------------------------- |
| The Fountain of ETH | [0xB5bD20248cfe9480487CC0de0d72D0e19eE0AcB6](https://etherscan.io/address/0xB5bD20248cfe9480487CC0de0d72D0e19eE0AcB6) |
| The Stable Garden   | [0x1D50c4F18D7af4fCe2Ea93c7942aae6260788596](https://etherscan.io/address/0x1D50c4F18D7af4fCe2Ea93c7942aae6260788596) |

### Heart

| Contract Name | Address                                                                                                               |
| ------------- | --------------------------------------------------------------------------------------------------------------------- |
| Heart         | [0x51e6775b7bE2eA1d20cA02cFEeB04453366e72C8](https://etherscan.io/address/0x51e6775b7be2ea1d20ca02cfeeb04453366e72c8) |
| Heart Garden  | [0xaA2D49A1d66A58B8DD0687E730FefC2823649791](https://etherscan.io/address/0xaA2D49A1d66A58B8DD0687E730FefC2823649791) |

### Prophets

| Contract Name                | Address                                                                                                               |
| ---------------------------- | --------------------------------------------------------------------------------------------------------------------- |
| Prophets NFT                 | [0x26231a65ef80706307bbe71f032dc1e5bf28ce43](https://etherscan.io/address/0x26231a65ef80706307bbe71f032dc1e5bf28ce43) |
| The Arrival (Auction + Mint) | [0xe9883aee5828756216fd7df80eb56bff90f6e7d7](https://etherscan.io/address/0xe9883aee5828756216fd7df80eb56bff90f6e7d7) |

### Integrations

| Contract Name             | Address                                    |
| ------------------------- | ------------------------------------------ |
| MasterSwapper             | 0x6021FEb20Da9235b46880f8f40cD21C9907Fa5FB |
| LidoStakeIntegration      | 0xC5A6075E4db4FC24785CE4208C548c9B8c1B3622 |
| CurvePoolIntegration      | 0x0a2737320D5b5515860a21CC15904C55352d4438 |
| CurveGaugeIntegration     | 0x23974777E1712ecEa5FAdf6ad93c2bC39d53Df61 |
| ConvexStakeIntegration    | 0xF8B6d144d7b0026980b7ef1E488F6F09Ad426F49 |
| UniswapV3TradeIntegration | 0xc300FB5dE5384bcA63fb6eb3EfD9DB7dFd10325C |
| CompoundLendIntegration   | 0xFbbF642eC7D336B8e62CbF60Bf0a2a92C8566e56 |
| CompoundBorrowIntegration | 0xe3a342a6b4755E545dF1b65642292D1d5C25907D |
| FuseLendIntegration       | 0x46386d91b82795a9A90E5864316d5FFF0799E1eE |
| FuseBorrowIntegration     | 0xB0edba4Aa284020c1a57311110A32ff6A439C8Fa |
| AaveLendIntegration       | 0x7D957E6175eC49341Fa843b01aDf2440a8bB7dfF |
| AaveBorrowIntegration     | 0x048d4c45C5963320f7E1893138Aed34084948242 |
| UniswapPoolIntegration    | 0x423eaC6108DadE6F9DF7582d0e1A73B6576f6c59 |
| PickleJarIntegration      | 0x17B3c28955676Ad4A857706BEA94D572e27e66C2 |
| PickleFarmIntegration     | 0x50d551F0D71Ca010C931be5966d0FD03Cc176195 |
| StakewiseIntegration      | 0x699118Bd7cda572A25dDda8A04E409719744683E |
| SushiswapPoolIntegration  | 0x5444E6D6f8Acc6e0f1BC19A75FB84214fd84C374 |
| YearnVaultIntegration     | 0xa06cc96aC32dc54AEB031074866770DDED60B44E |

### Governance

| Contract Name       | Address                                                                                                                            |
| ------------------- | ---------------------------------------------------------------------------------------------------------------------------------- |
| Babylon Governor    | [0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24](https://etherscan.io/address/0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24#readContract) |
| Timelock Controller | [0xe6ed0eacb79a6e457416e4df38ed778fd6c6d193](https://etherscan.io/address/0xe6ed0eacb79a6e457416e4df38ed778fd6c6d193)              |
| Treasury            | [0xD7AAf4676F0F52993cb33aD36784BF970f0E1259](https://etherscan.io/address/0xD7AAf4676F0F52993cb33aD36784BF970f0E1259)              |


# Tokenomics

This page describes the $BABL tokenomics

The $BABL token is the governance token for the Babylon protocol. It ensures that **Babylon is owned by its users.**&#x20;

**69% of $BABL tokens belong to the community,** dynamically rewarding stakeholders for investing, generating ideas, curating plays, and managing communities based on a community’s performance and AUM.

The protocol goal is to have the best investment communities in the digital asset class. The protocol is designed to ensure that all the participants are aligned in their individual motivations to achieve this common goal.

You can read more in our [Medium announcement](https://medium.com/babylon-finance/announcing-babl-8f41b58c52c5).

## Distribution

1 million $BABL was minted during the token generation event. The max supply is also 1 million. The $BABL is distributed as follows:

* **69% for the Babylon community members**. Most of it will be distributed to Gardeners, Strategists, Stewards, and LPs as part of the [BABL Mining Program](/babl/mining).
* **19% Seed investors,** partners, and advisors. Three year vesting period.
* **10% Team members**. Four year vesting.
* **2% Reserved** for a future round.

![](https://firebasestorage.googleapis.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MU6ZbTQOlfV8oj9cw0O%2Fuploads%2FOrKwa7gizjcCD0m9QMCg%2Ffile.png?alt=media)

*Community Distribution Split*

The 690,000 tokens allocated to the community will be split as follows:

* **500,000 in Participation Mining rewards for the community.** They will be awarded to community Creators, Strategists, Stewards, and LPs based on the performance and amount of assets in each Garden.
* **50,000** reserved for the **$BABL liquidity** event, [The Prophets NFT IDO](/prophets/2592-prophets) and additional liquidity mining program&#x73;**.**
* **140,000 for the protocol treasury** to fund new initiatives and pay contributor&#x73;**.**

## Governance

{% content-ref url="/pages/-MU9FFfailbTWyTlKpo\_" %}
[Governance](/babl/governance)
{% endcontent-ref %}

## $BABL Participation Rewards Program

{% content-ref url="/pages/-MU9LVUE0MYPbm1cjxLJ" %}
[BABL Mining Program](/babl/mining)
{% endcontent-ref %}


# 🫀 Heart

You can find the original post on Medium here:

{% embed url="<https://medium.com/babylon-finance/the-heart-of-babylon-defi-3-0-6d16e35817f2>" %}

And the latest changes here:

{% embed url="<https://medium.com/babylon-finance/the-heart-of-babylon-reloaded-6a74f4044f95>" %}

Babylon Finance introduced the Heart as a 💪 **staking mechanic for BABL holders**.

First of all, we are using our **own Garden technology to 🐶 dogfood and create this mechanic**. As you may know, Babylon Finance lets people create and invest together through investment DAOs that we call 🌴 Gardens. Garden members create DeFi strategies and invest in DeFi together, sharing the gas costs and the returns.

🫀**The Heart of Babylon** is a **garden** that receives BABL as deposits and will give depositors hBABL. The heart receives 100% of the protocol fees and BABL from stakers and infuse them both with renewed energy.

💪 🌴 hBABL is a super garden token that includes **10 + 1 different mechanics** inspired by the very best of DeFi and synthesized together to provide value to BABL holders and Babylon users alike.

![](/files/6EimFre6M8o5sdTuYwxx)

You can see the TLDR of the Mechanics here and a full explanation of each of these mechanics will follow in separate posts👇

## ⏰ TLDR: “Show me the money” <a href="#da0a" id="da0a"></a>

Current Capacity: 150k BABL 🏛 / Original Launch Date: February 3rd 📆

First of all, BABL already has in place a **powerful mining program (1)**. Our [mining program lasts for 10 years and distributes 50% ](https://docs.babylon.finance/babl/mining)of all the tokens to the Babylon users that are providing the most value, i.e generating wealth together.

* 🔐 Holders lock BABL for 6 months to 4 years. **hBABL is a voted escrow token (2)** similar to [veCRV tokens from Curve](https://resources.curve.fi/base-features/understanding-crv). The longer you lock your tokens, the higher the voting power.
* 🎟 BABL holders can lock BABL along with a reserve pair (ETH, DAI…)to get a [**discount on BABL**](/babl/heart/heart-bonds) **(3)** similar to[ Ohm bonding program](https://docs.olympusdao.finance/main/basics/bonding).
* 💸 **Management and performance fees (4)** will accrue to hBABL holders. Similar to [xSushi](https://help.sushidocs.com/faqs/faqs#:~:text=What%20is%20xSUSHI%3F,How%20are%20xSushi%20rewards%20sent%3F\&text=When%20the%20rewards%20contract%20is,Sushi%20\(on%20SushiSwap%20Exchange\).).

These fees will be used to increase the value of BABL and hBABL in the following way:

* 📈 **10%** of the fees **(5)** will be used to increase [**trading liquidity for BABL**](https://medium.com/babylon-finance/supercharging-babl-eth-liquidity-a5b45e770356) .
* 🫀 **10%** of the fees will be **used to buyback BABL (6)** and gift 50% of these back to the Heart Garden. The other 50% will be locked in the treasury. This will automatically increase hBABL share price.
* 🌱 **20%** of the fees will be used **to invest in different gardens (7)** to generate yield . Similar to [Tokemak Reactors](https://docs.tokemak.xyz/), hBABL holders can collectively decide to provision capital and decide where to allocate it. BABL rewards will be claimed and reinvested every 4 weeks.
* **⚙️ 10%** of the fees will be **lent via our Fuse pool (8)**. When available, the heart will also borrow to generate additional yields that will also be put to use. Here is our [Fuse Pool on Rari](https://app.rari.capital/fuse/pool/144).
* 🏛 **45%** of the fees will be **sent back to the treasury** to increase Protocol Controlled value.
* :shield: **5% of the fees** are used to **buy smart contract cover** and create a reserve pool for incidentals.

The BABL deposited in the heart will also be working:

* **85% of the staked BABL will initially be lent on our Fuse pool.** through a garden strategy inside the heart. This will generate lending fees. When available, the heart will also borrow stables and farm additional yield through “safe” strategies like stETH. **hBABL holders will vote on the strategies similar to how strategies are voted in other gardens (9)**.

Finally, **hBABL holders will be able to vote for free via signatures (10)** 🗳 and the heart will vote on-chain on our governor with the aggregate decision of all holders. All the other gardens will also delegate unclaimed BABL power to the heart. The longer you lock, the higher your voting power.

All the weights and percentages above can be changed by hBABL holders.

## 🌟 One more thing… <a href="#id-9ed5" id="id-9ed5"></a>

Other DeFi protocols can also use our **gardens to create a super-charged token mechanic for their governance tokens and/or organize their community to manage the treasury through a garden**. For example, let’s imagine our friends at Pickle want to use this mechanic.

* Pickle could create an **official garden** for their community where users deposit PICKLE (or ETH) and receive hPickle in return.
* PICKLE is added to our Fuse Pool to be used as collateral and borrowings are used to invest in different Pickle Jars.
* Strategies will be generating returns and purchasing more PICKLE with the proceeds.
* The garden then becomes a **de-facto index of the best pickle strategies** and hPickle holders would be earning BABL on top.

If you want to use Babylon please ping us directly at <founders@babylon.finance> 📪


# Heart Bonds

{% embed url="<https://medium.com/babylon-finance/introducing-heart-bonds-30afa2ff82db>" %}

![](https://miro.medium.com/max/1400/1*fyCVGPwTW9Dd2q1SJp38gQ.png)

Almost two months ago, we released 🫀 [The Heart of Babylon](https://medium.com/babylon-finance/the-heart-of-babylon-defi-3-0-6d16e35817f2) a supercharged staking mechanic for BABL holders combining +10 token mechanics from the best of DeFi.

The Heart has already generated 27% extra BABL for stakers, averaging **160% APR.** It is not a surprise that the capacity was reached quickly and it had to be increased twice through [governance proposals](https://docs.google.com/document/d/12dx7CtJDZBmSKnF_07SklE1iMhj5njXmwEuAy5KFnNA/edit#heading=h.2lbbnnssblwx).

Today, we are excited to **introduce the Bond program**, so Babylonians can receive extra discounts on BABL staking — up to 10% — for giving the protocol assets that Babylon needs.

![](https://miro.medium.com/max/1400/1*WmQzYCxsY6sAEKUrT31gow.png)

## 📖 A brief note about bonding <a href="#id-596c" id="id-596c"></a>

According to Investopedia, a bond is a [fixed-income instrument](https://www.investopedia.com/terms/f/fixed-incomesecurity.asp) that represents a loan for a specific duration made by an investor to a borrower. In the simplest case, upon maturity, the depositor receives the principal.

[Olympus](https://medium.com/babylon-finance/the-heart-of-babylon-defi-3-0-6d16e35817f2) (OHM) popularized the concept in DeFi to allow the protocol to accumulate *Protocol Controlled Liquidity* (PCV) in exchange for discounts to the bonder.

In Babylon, the protocol wants to acquire the following assets:

* 🦄 **BABL-ETH Uniswap V3 LP tokens**. We want to substantitally increase the liquidity of our pair to provide more depth for traders and prevent liquidation cascades i.e [MEV incident](https://medium.com/babylon-finance/the-mev-doom-loop-f0c0d5c9523b) 🤖.
* 🤝 [Babylon Gold Lender Fuse Pool LP tokens](https://medium.com/babylon-finance/babylon-lending-markets-e0aee652e8c2). We created **lending and borrowing markets** to allow Babylonians and Gardens to use BABL as collateral. We need to increase the liquidity to expand our support to partners.

## 🥇 How to bond BABL-ETH — 5% Discount <a href="#id-1957" id="id-1957"></a>

🦄 Our [BABL-ETH](https://info.uniswap.org/#/pools/0xe2de090153403b0f0401142d5394da897630dcb7) pair on Uniswap has now more than $1M in liquidity. Our goal is to increase this number to +$2M in the next 6 months.

To facilitate the process to add liquidity to the pair, we have paired with Gamma. Users only need to deposit [BABL-ETH](https://app.gammastrategies.org/) into gamma and receive typical ERC-20 tokens that then can bond into the heart.

Here is how to do it 👇

1. [Head to Gamma](https://app.gammastrategies.org/active-liquidity?pair=eth-babl)
2. Select Mint LP Tokens to Wallet

![](https://miro.medium.com/max/1400/1*VO54go46cq2IsAHHHeNDew.png)

3\. Select the amount of BABL & WETH that you want to deposit. At least $3k in combined value.

4\. Approve BABL & WETH and then send the transaction to get the LP tokens.

5\. Head to the heart page (<https://www.babylon.finance/heart>)

6\. Click on Bond

7\. Select BABL-ETH

8\. Approve it and send it

9\. **Receive 5% extra staked BAB**L 🎊

![](https://miro.medium.com/max/1400/1*yk1_rKQOMbHHmwFI_p3h-A.png)

## 🥈How to bond Babylon Fuse Tokens — 3% Discount <a href="#id-04aa" id="id-04aa"></a>

Our Fuse Pool currently has more than [**$6.3M in supplied capital**](https://app.rari.capital/fuse/pool/144/info). We want to increase this number to +$10M during the year to add tokens from different partners while keeping enough liquidity for all borrowers.

1. Head to our pool on Rari (<https://app.rari.capital/fuse/pool/144>)

![](https://miro.medium.com/max/1400/1*z-hEnEi03DQmZRksgJ0o0Q.png)

2\. Click on DAI or FRAX on the left side.

3\. Select the amount (at least $3k)

![](https://miro.medium.com/max/1400/1*glY5JUG-0M_m1HFlIg5LTA.png)

4\. Confirm the transactions to receive your LP tokens.

6\. Click on Bond

7\. Select fDAI or fFRAX

![](https://miro.medium.com/max/1400/1*yk1_rKQOMbHHmwFI_p3h-A.png)

8\. Approve it and send it

9\. **Receive 3% extra staked BAB**L 🎊


# BABL Mining Program

This page explains the participation mining program.

BABL Mining Program was the first governance proposal.  It was approved unanimously by the token holders. Rewards started on October 16th 2021.

**500,000 tokens** will be allocated to the BABL Mining Program, representing 50% of the total token supply over ten years.

You can read the initial Medium announcement [here](https://medium.com/babylon-finance/babl-mining-program-4829c313268d).

![](/files/-MYX8tJtdmpJMcgbqDZL)

## TLDR

* The Mining Program lasts for aprox. **10 years**.
* Only **active strategies** earn BABL.
* Members can claim the BABL **only after the strategy has completed**.
* The **longer** the strategy lasts, the more BABL it earns.
* The **more capital** the strategy has, the more BABL it earns.
* The **more returns the strategy has**, the more BABL it earns.
* **Staked prophets** in gardens give garden members additional bonuses in the mining program.
* **Strategist receives 10% of the BABL** of a strategy (if it returns profits).
* **Voters receive 10% of the BABL** of a strategy.
* **Garden members receive 80% of the BABL** of the strategy weighted by their ownership of the garden and how long were they in the garden relative to the duration of the strategy.

## Supply Curve

Let’s start with the **supply curve**. The supply curve is designed to optimize the long-term sustainability of the protocol. The rewards are front-loaded, slowly decreasing quarter by quarter.

Participation rewards will run for at least **8 years**. We are targeting a specific number of rewards per quarter but the protocol may under-allocate or over-allocate depending on the market conditions.&#x20;

Here is how we will calculate the rewards target for a given quarter E:

$$
RewardsQuarter(E)=R\_q(E) = RP -RP\*(1/1.12)^E - RpSpent(E)
$$

$$
RP = BABL for Mining Program = 500,000
$$

$$
RpSpent(E) = Rewards SpentUntilE
$$

This creates the following supply curve for the Participation Rewards Program:

![](https://firebasestorage.googleapis.com/v0/b/gitbook-x-prod.appspot.com/o/spaces%2F-MU6ZbTQOlfV8oj9cw0O%2Fuploads%2FEnBY2jTAF90Ae1zdpVzh%2Ffile.png?alt=media)

## Rewards per epoch and per block

Given the supply curve, we can calculate how many rewards we can distribute per second of a specific quarter. Rq(E) for a given epoch E. An epoch is three months or a quarter.

Then we calculate the max number of rewards to distribute in a second dividing by the number of seconds in the epoch. Rs (Rewards per second) is then calculated as follows:

$$
Rs(E) = Rq(E) /(90 days/Epoch \* 24 h/day \* 60 min/h \* 60 secs/min)
$$

## Strategy Rewards (baseline)

It is important to make sure that the incentives of all the participants are aligned. To that end, we only **reward participants involved in active Strategies**. Active Strategies are the ones that received enough votes to attract capital from the Garden.

The rewards of a Strategy are based both on the **reserve asset** (ETH) allocated (“Principal”) and the **number of seconds** that the Strategy was active. These rewards will also be based on the amount of principal allocated to other Strategies in the protocol during that same time period.

In short, the max rewards of a Strategy can be modeled as follows:

$$
StrategyPower = StrategyPrincipal \* StrategyDuration
$$

$$
ProtocolPower (E)= Σ\_i^n (StrategyPrincipal (strategy\_i) (ETH) \* StrategyDuration (strategy\_i) (secs))
$$

$$
StrategyRewards(E)(strategy\_i)= StrategyPower(strategy\_i) /
ProtocolPower(E)\*Rq(E)
$$

### Example

As an example, if a Strategy "i" received 1ETH and lasted 1 hour:

*StrategyPower(strategy\_i) = 1 \* 60\*60 = 3600 weight*

If we also assume that there were other 10 strategies in addition to our strategy "i" with a total of 50 ETH (5 ETH each) during that same time period and that we are in Q1, where rewards are 53,571 BABL:

*ProtocolPower(E) = 10 \*(5 ETH\* 3600 secs) + (1 ETH \* 3600 secs)= 183,6K weight*

*StrategyRewards(Q1)(strategy\_i) = 3600 / 1.836 \* 10^5 = 0.02 \* 53,571 = 1,050.41 BABL*

When a Strategy duration is longer than a quarter, it will get proportional BABL tokens per quarter. In that case, the strategy "i" will get:

$$
StrategyRewards (strategy\_i) = Σ\_j^N StrategyRewards(E\_j)(strategy\_i)
$$

$$
Σ\_j^N ((StrategyPower(E\_j)(strategy\_i)/ProtocolPower(E\_j))\*Rq(E\_j))
$$

The Strategy will get the sum of the corresponding rewards from each epoch (each of them will depend on each protocol power and the available number of tokens per quarter/epoch).

This calculation provides the strategy rewards "baseline". In the following section we will discuss about the new weights introduced by the decentralized governance.

$$
StrategyRewardsBaseline (strategy\_i)
$$

### Adjusting based on performance vs. principal

As part of the decentralized governance proposal [bip#1](https://www.withtally.com/governance/babylon/proposal/86895390742944283448920585513992384112055913494715263243154281712731665188411), and later in [bip#7](https://www.withtally.com/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/42309909082201573650128991948203453910830611292212115544850475689408371624584), the community decided to introduce new weights to penalize strategies that are farming BABL without generating wealth.

The performance (returns) must have higher impact than the principal (capital allocated) in the final rewards received by each strategy. These are the weights:

* *Principal Weight* (5%): represents the principal weight to apply to the baseline.
* *Profit Wei*ght (95%): represents the weight of profits to apply to the baseline.

Therefore, the **profits of a strategy** represent the most important factor to determine BABL rewards earned. We want to encourage strategists, stewards an garden creators to create, vote and execute the best performing strategies as possible.

Note that the profit can be positive or negative, which means that we can get more BABL than provided by the baseline but negative profit strategies will get less than if they were only based on principal.

### Negative, break-even and positive strategies

In order to carry out the goal to reward strategies, BIP-7 divides the strategies into three different buckets based on its profits.\
\
**Bad strategies:** all strategies that are **under -20% returns** annualized belong to this segment. These strategies will get only <mark style="color:red;">15% of the rewards</mark> (85% slashed).

**Break-even strategies**: all strategies which are above -20% but are **still under 4% returns annualized** belong to this segment. These strategies will get only <mark style="color:yellow;">60% of the rewards</mark> (40% slashed).

**Profitable strategies:** all strategies which are equal or **above 4% annualized** returns belong to this segment. These strategies will get an additional <mark style="color:green;">bonus of 15% rewards</mark> i.e they will receive 115%. After BIP-7 there is no max cap for the strategies, so higher returns mean higher BABL without any limit.

Each Strategy will get then its BABL rewards as follows:

$$
StrategyRewards(E)(strategy\_i)= StrategyRewardsBaseline(E)(strategy\_i)\*(PrincipalWeight +  Profit(strategy\_i)*ProfitWeight*BenchmarkRatioForSegment)
$$

where "*BenchmarkRatioForSegment*"  is 15% for segment 1, 60% for segment 2 and 115% for segment 3.

### Heart  strategies

In case of the strategy belongs to the Heart of Babylon, it will always get a <mark style="color:blue;">bonus of 50%</mark> (i.e. they will receive 150%).

## Rewards per participant

At this point, we know how much BABL to allocate to a finalized Strategy. However, we still need to **distribute this BABL among all the participants** for that Strategy.&#x20;

In addition to BABL rewards (which are based mostly on participation), the **protocol will also distribute the Profit Rewards** (if any) among the different participants depending on their active role. 5% of the profits are allocated to the treasury of the protocol, the other 95% is allocated to the participants following the garden default or customized distribution.

With regard to BABL rewards, LPs get 80%, the Strategist gets 10% and the Voters get 10% of Strategy BABL rewards. To summarize, we outline the profit-sharing below but we will focus on the BABL rewards. You can read more about each participant and the profit split in the [litepaper](/protocol/litepaper#profit-and-reward-split).

Now, we are going to cover the reward baseline for each type of participant.

### 🧠 **Strategists**

**10%** in BABL Rewards

The creator of the Strategy will receive 10% of BABL rewards if the Strategy is successful. In order to align incentives, **Strategies that result in losses for the Garden will not result in any BABL rewards** for their Strategists.

*e.g. If 100 BABL rewards are delivered to the Strategy"i" in total, 10 goes to the Strategist in case it is a profitable Strategy.*

The Strategist will also receive 10% (or the customized % value per each garden, if any) of the Strategy profits (if any) if the Strategy was successful. On the other hand, **if the Strategy is not successful, the protocol will slash the Strategist's stake**.

*e.g. If 100 ETH are returned as profits, the Strategist will get 10 ETH.*

### 📰 **Voters**

**10%** in BABL Rewards

All the Voters that upvoted the strategy will receive their proportional share of the rewards based on the number of votes cast by each member.

*e.g. If 100 BABL tokens are delivered to the Strategy" i" in total; 10 will be split between Voters according to the votes cast by each Voter.*

Voters will also receive a total performance fee of 5% (or the customized % defined at the garden level, if any) of all the Strategy Profits in ETH. You can see a table with the specifics in the [litepaper](/protocol/litepaper#profit-considerations).

*e.g. If 100 ETH are returned as profits, Voters will get in total 5 ETH that will be split according to the votes cast by each Voter.*

*Adjustments: as there are multiple cases, we recommend to read the section "*&#x41;djusting based on performance and expected return&#x73;*". Anyway, here we provide a summary of the different adjustments:*&#x20;

* *i*f the strategy got no profits at all and all users voted for the strategy, **there will be no rewards for stewards** as a mechanism to protect the protocol from bad strategies.&#x20;
* If some users voted against its execution and it finally had no profits, the 10% will be distributed only between those who tried to protect the protocol voting against it.&#x20;
* On the other hand, stewards voting against a strategy returning profits above its expected return will get no rewards as stewards, as they were voting against the execution of a good strategy. In this case, the 10% will be distributed among the users who voted for the strategy.

### 🧧 **Liquidity Providers**

**80%** in BABL Rewards

All Garden LPs that deposit in gardens with active strategies receive 80% of the BABL rewards split based on the amount deposit by each member. The amount depends also on the time the user has been a member of the garden relative to the duration of the strategy

*e.g. If 100 BABL rewards are delivered to the Strategy" i" in total, 80 goes to LPs, proportional to their ETH deposited during the Strategy execution period.*

LPs will also receive a total of 80% (or the garden customized value, if any) of the Strategy profits proportional to their ETH deposited during the Strategy execution period.

*e.g. If 100 ETH are returned as Strategy profits, LPs will get  80 ETH split between them based on the amount they had deposited in the Garden at the moment of strategy execution. Contributor power will consider when contributor deposits took place and the size of each deposit out of all garden deposits.*

### 🌱 **Gardeners**

**1.10x Multiplier in BABL Rewards**

The Gardener is also an active member of the Garden. As the Gardener of the community, they gets a special bonus for all the other activities that they perform as a member.

## 🛡️Prophet Bonuses

Prophets that are **staked in a garden** gives the user extra bonuses in the mining rewards of that garden.

Prophets offer **boosts to the participants** based on the bonus type.

* 🧧LP Bonus. The LPs get in aggregate 80% of the BABL of the strategy. If you stake a prophet that has a lp bonus, **you will receive a bonus on your proportional share of the lp BABL rewards**.&#x20;

*e.g. If 100 BABL rewards are delivered to the Strategy" i" in total, 80 goes to LPs, proportional to their assets deposited during the Strategy execution period. If you have 10% of the assets and a 3% prophet staked bonus, you would receive 8.24 BABL instead of 8.*

* 📰 Voter Bonus. The voters get in aggregate 10% of the BABL of the strategy. If you stake a prophet that has a voter bonus, **you will receive a bonus on your proportional share of the voting BABL rewards**.&#x20;

*e.g. If 100 BABL tokens are delivered to the Strategy" i" in total; 10 will be split between Voters according to the votes cast by each Voter. If you have 20% of the voting power and a 2% prophet staked bonus, you would receive 2.04 BABL instead of 2.*

* 🧠Strategist Bonus. If you stake a prophet that has a strategist bonus, it will be **added to the 10% mentioned above**.&#x20;

*e.g. if your great prophet gives you a 1% bonus, your strategist BABL rewards will be 11% of the strategy instead of 10%.*

* 🌱 Gardener Bonus. If you stake a prophet that has a gardener bonus, it will be **added to the 1.10x multiplier above**.&#x20;

*e.g. If your great prophet gives you a 3% bonus, your multiplier will be 1.13x instead of 1.10.*

### Summary

The total sum of BABL rewards will then be divided into the different profiles:

$$
StrategyRewards(strategy\_i)= StrategyRewardsStrategists(strategy\_i) + StrategyRewardsVoters(strategy\_i) + StrategyRewardsLPs(strategy\_i)
$$

where:

$$
StrategyRewardsStrategist (strategy\_i)= StrategyRewards(strategy\_i) \* StrategistWeight
$$

$$
StrategyRewardsVoters(strategy\_i) = StrategyRewards (strategy\_i) \* VotersWeight
$$

$$
StrategyRewardsLPs(strategy\_i) = StrategyRewards(strategy\_i) \* LPsWeight
$$

**Note**:  the Gardener will get the 1.10x multiplier on all the other roles taken in this Garden. Strategist and Voters will be able to get additional tokens (limited by a 2x cap) depending on the expected return as described below.

## Adjusting based on performance and expected returns

The BABL rewards explained above are refined based on performance to ensure that Babylon rewards Strategies that return capital and respect the opportunity cost associated with executing them.

### Expected return

The "*expected return*" concept is a key element in Babylon. It is set by the Strategist based on market conditions, knowledge, and experience. Voters **review the Strategy details, including the expected return,** set by the Strategist to decide whether or not it is a good use of the Garden's capital. Voters need to stake their Garden Tokens to vote so Voters need to pick the Strategies they want to vote on wisely.&#x20;

The protocol tries to ensure that the dominant tactic for each participant is aligned with the goals of Babylon.

* Strategies are penalized if they inflate their expected returns. Their BABL rewards are tuned based on the accuracy of their prediction.&#x20;
* Voters are disincentivized from upvoting or downvoting without enough information. They are locking their BABL tokens and will only get rewarded when they provide an accurate signal.

### Negative Strategies

Strategies that result in losses will **only provide BABL rewards to Voters that downvoted the strategy**. The Strategist and the Voters that upvoted it do not receive any rewards. The Strategist's stake gets also slashed with a quadratic penalty of **-1.75x the % of losses**.&#x20;

*e.g. If a Strategy loses 5% of capital (capital returned / capital allocated = 95%), the Strategist will get a quadratic penalty of 1.75x 5% = 8.75% of the Strategist stake will then be burned by the protocol.*

### Real Return vs Expected Return

Adjustments to the baseline model are done based on the distance between the expected return and the real return.

#### 🧠 **Strategist Bonus**

Strategist receives a bonus (**capped to a max of 2x**) of BABL rewards based on the accuracy of their prediction. The more accurate it is, the more BABL rewards the Strategist receives.

On the other hand, a negative strategy (with negative profits) will not provide BABL rewards to Strategists and the Strategist's stake will be slashed as defined above.

#### 📰 **Voter Bonus**

Voters voting in **favor** of a **profitable Strategy** will get proportional **BABL rewards depending on their stake** (vote) out of the total positive votes. Users voting in favor of bad strategies with negative results will get 0 BABL rewards as they contributed to draining the capital of the Garden.

Voters voting **against** a Strategy will get **BABL rewards only if the returns are below the expected** return. The bonus has a max cap of 2x.  It will also be proportional to the stake used for the vote out of the total negative votes.&#x20;

## Montecarlo Simulations

* You can check the numbers of a Montecarlo simulation with 🔢 [**200 strategies here**](https://docs.google.com/spreadsheets/d/1jsvRCogeuXTcUICUgqqU81m8PP919lVCaw0KxrrUCAU/edit?usp=sharing).

![](/files/7x8APzN5ygpxnKzaVFWu)


# Governance

The team developed the initial version of the protocol and is handing over control to $BABL holders on public launch.

$BABL holders will share **protocol ownership** and **vote on proposals** through an on-chain governance system called the [Babylon Governor](/babl/governance/babylon-governor). If you are new to blockchain governance, [you can read more here](https://blockgeeks.com/guides/what-is-blockchain-governance-ultimate-beginners-guide/).‌

We have designed the protocol with the goal of **self-sustainability** and **governance-minimization**. Coordination is a complex and expensive task. Members need assurances that the protocol is not going to change against their interests.&#x20;

$BABL holders may change over time. In order to remain credible, the protocol needs to be resistant to value capture. Babylon has the smallest governance surface area needed to function, also known as “[**essential governance**](https://www.fehrsam.xyz/blog/governance-minimization)”.‌

The $BABL governance token will control the following:‌

* **Treasury Management**. $BABL holders will decide how to allocate the fees collected by the protocol.
* **Protocol Fees**. Management and performance fees can be changed through governance.
* **$BABL Participation Rewards Program**. Governance controls the parameters of the $BABL Participation Rewards Program.
* **Integrations**. $BABL holders will be able to add/remove integrations with other DeFi & Ethereum protocols.
* **System upgrades**. Proposals will be able to upgrade several core components of the protocol like the price oracle, Strategies or Gardens.

### Handing over the 🔑

The team will work towards **progressive decentralization**. The founding team’s goal is to create a secure and usable protocol that reaches **protocol-market fit**. The ultimate goal is to remove any dependency from the founding team as soon as it is viable to do so. These are the expected stages of decentralization:

* Development and Alpha/Beta. Initially, there will be a **multi-sig** comprised of team members and advisors that will be able to change the protocol parameters and perform rescue functions in case of an emergency.
* Once the protocol is battle-tested and has reached a stable equilibrium, the team will remove the upgradeable contracts and **hand over full control of the multi-sig**. On-chain governance through [Babylon Governor](/babl/governance/babylon-governor) will be enabled.

### Governance Proposals

Governance will be performed on-chain through Governor Alpha using **$BABL weighted voting**.&#x20;

Protocol governance will decide:

* **Controller**
  * Integrations to add/remove
  * Edit Protocol fees
  * Early penalty fee
  * Profit split between participants
  * $BABL split between participants
  * List of Strategies
* **BABL**
  * Mint tokens
  * Issue inflation
* **Garden**
  * Emergency shutdown of a community (for security reasons)
* **Treasury**
  * How to allocate the protocol treasury ($BABL)


# Babylon Governor

![](/files/fPoZIWYng7WUoHYkwMAx)

[Babylon Governor](https://medium.com/babylon-finance/introducing-babylon-governor-6d9e45d7ca3c) enables anyone who holds **$BABL**, Babylon’s governance token, to submit proposals and **vote on protocol-level decisions, beginning with treasury management.**

The treasury receives 5% of profits and 0.5% of capital allocated through Babylon. 69% of the total supply of $BABL is reserved for the community and we expect the first governance proposals to be submitted in the coming weeks to allocate treasury capital to the benefit of the protocol and its users.

Babylon Governor marks the first mainnet deployment of [Open Zeppelin’s Governor](https://blog.openzeppelin.com/governor-smart-contract/). The contract is compatible with Governor Alpha and Bravo, and we are using [Tally](https://www.withtally.com/) to provide a simple user interface to delegate votes, create proposals, and cast votes on proposals.

## Governance Process

* New proposals are discussed in a dedicated Discord channel
* Discord and/or Snapshot (to be added later) is used for signal voting on proposals
* Proposals (with code) are submitted to Babylon Governor and voted on with Tally

## Governance Parameters

* **Voting delay**: 1 block

  Time from proposal submission to start of voting period)
* **Voting period**: 1 week

  How long proposals can be voted on.
* **Quorum**: 40,000 $BABL (4% of supply)

  How many votes are needed to pass a proposal.
* **Proposal threshold**: 5,000 $BABL (0.5% of supply)

  Tokens required to submit proposal

<br>


# Proposals

List of Proposals and their status.

You can see all the proposals and votes on-chain on the governor page in Tally<br>

{% embed url="<https://www.withtally.com/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24>" %}

You can vote for free if you are a member of the [heart](/babl/heart). Head to the heart to cast your vote.

{% embed url="<https://babylon.finance/heart>" %}

### Past Proposals

1. &#x20;**BIP-1**: [$BABL Mining Program](https://docs.google.com/document/d/1UIEUcXMmlxizPMlOa4SRQNuYOlbv4eJmlm-PS03Kc3s/edit#heading=h.2lbbnnssblwx) - `Approved`
2. **BIP-2**: [Babylon Foundation](https://docs.google.com/document/d/1nrWts9gc_RyX-DEpTMQceGmwmRDDzLr-QpQ6Ugl7yB4/edit#heading=h.4pkltwaj1bx5) - `Approved`
3. **BIP-3**: [The Prophets Arrival ](https://docs.google.com/document/u/1/d/1p751X2x1lf97OdGHB7eNlcVFViYNl0iu9d5P0MY9JVM/edit#)- `Approved`
4. **BIP-4:** [Uniswap v3 + Harvest](https://docs.google.com/document/d/1d3ZCVrvekktGhbiPLMNzw_1n8-12iYerm5GI2XAN_MY/edit) - `Approved`
5. **BIP-5:** [Babylon Seed Funding](https://docs.google.com/document/d/1M_BsdCst2IXCRX5DjHuvW0aN-0yW0pDDSl6hJBoX4LU/edit?usp=sharing) - `Approved`
6. **BIP-6:** [Babylon Diplomats](https://docs.google.com/document/d/19a40zJIx_4JnaCoKpwmGaDYV2uzf1tKP4VSXrRzoRok/edit#) - `Approved`
7. &#x20;**BIP-7:** [Mining Adjustment](https://docs.google.com/document/d/1yMKiYWjYHD3kxFdpN5DqqKQW53e1xYCu8a1wSQ7NBJE/edit#)- `Approved`
8. **BIP-8:** [BABL Fuse Pool](https://docs.google.com/document/d/1QizANfp59EwYuvU5LDhaduV6yIqsRJnxEwV5D2KjAGU/edit#) - `Approved`
9. **BIP-9**: [Development Fund](https://docs.google.com/document/u/1/d/1C6p_4gsILJCFpTsCrNwFfSntE82El4SJSJgZYNBuy1g/edit) - `Approved`
10. **BIP-10**: [Heart Tokenomics](https://docs.google.com/document/u/1/d/1AYA7mjeOnYO6ODy2rD5HqAC75R1aa_QGFBh4Js9dvng/edit#) - `Approved`
11. **BIP-11**: [Heart Bonding Program](https://docs.google.com/document/u/1/d/1f71Xcq67o4xw5oa4Lsh6uYsOTHInmUC-XZUreQKUdhU/edit) - `Approved`
12. **BIP-12:** [Verified Gardens](https://docs.google.com/document/d/1LdbWcnyG_GG2KzDMjAxoMXNE9VzBLFSBYJy8F-MfJ_M/edit#) - `Approved`
13. **BIP-13:** [Enable Garden Token Transfers](https://docs.google.com/document/d/1iUfSgQZVCUhgas3MQZ-saYYSrnNceAv1zo-79cyYuu8/edit#) - `Approved`
14. **BIP-14:** [Increase BABL Liquidity](https://docs.google.com/document/d/12dx7CtJDZBmSKnF_07SklE1iMhj5njXmwEuAy5KFnNA/edit#heading=h.2lbbnnssblwx) - `Approved`
15. **BIP-15**: [Referral Program](https://docs.google.com/document/u/1/d/1mzyW5N1cw3Q_pMZcCyI1G9vAHGwLU35VlPiTwpBOys4/edit) - `Approved`
16. **BIP-16**: [Marketing Spend](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/10015185773157414746034784743836462091895169213864005592670733679822312309251) - `Approved`
17. **BIP-17**: [HackMoney Grant](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/24793948250029472218768149021450997854742207683782731217359843291070456377520) - `Approved`
18. **BIP-18**: [Verify Partner Gardens](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/36991166096317872536390464099422757581316990721078254119550388071166409754542) - Approved
19. **BIP-19**: [Babylon Shield](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/93421996078266288913900757925842757765741472971850515018264167322542349349737) - `Approved`
20. **BIP-20:** [Idle Finance Bounty](https://docs.google.com/document/d/1CJb827-tRJnCHEJHoNQuMSzzOkJDovk5ph5kA6blUR4/edit?usp=sharing) - `Approved`
21. **BIP-21:** [Security Bounty Rewards](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/21514074957108090911489421425678739498534527282577121527635622102194742845904) **-** `Approved`
22. **BIP-22:** [The Heart Of Babylon Reloaded](https://docs.google.com/document/d/1rRaUMW741RuHHFGqSPxb95cqYjK4nWZOTD49ft64xew/edit#) - `Approved`
23. **BIP-23:** [Fuse Hack Actions ](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/82375474957633426622541765424852873600349768070021673704036628167191474647983)- `Approved`
24. **BIP-24:** Bump rewards- `Under discussion`
25. **BIP-25:** [Security Bounty Rewards ](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/52568742925274466133386400284731251288414041647812700673930289619709761985746)- `Approved`
26. **BIP-26:** [BalancerV2 integration](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/37739355232741924385947675751466910155625583478655815511040285529952573461540)- `Approved`
27. **BIP-27:** [Security Bounty Rewards ](https://www.tally.xyz/governance/eip155:1:0xBEC3de5b14902C660Bd2C7EfD2F259998424cc24/proposal/21414675660784448222084279643271898402440921564126740617438077150892606709886)- `Voting`


# 🛡️ 2592 Prophets

Results and aftermath of the arrival

{% embed url="<https://medium.com/babylon-finance/%EF%B8%8F2-422-prophets-d4180afe62a5>" %}

That’s the final number of prophets that have arrived at Babylon and have survived the great burn ❤️‍🔥

5,503 common prophets have perished 🪦☠️

**🛡️2,592 surviving prophets, we march onwards.**

![It does look like rain...](https://miro.medium.com/max/1400/1*yF0y8lVGPuAlVq7eZZ425A.gif)

> For honor’s sake, for duty’s sake, for glory’s sake, we march, into hell’s mouth we march…

It’s our job to onboard, evangelize and share Babylon with the rest of the internet. We are here because we believe **crypto is the biggest opportunity that we have seen in our lifetimes** and we want to invite others to join us to create generational wealth by investing in DeFi together.

Today, a **new era begins for Babylon Finance**.

## Arrival Aftermath <a href="#ce04" id="ce04"></a>

First of all, let’s recap the results of the event related to the goals we set in the [original post](https://medium.com/babylon-finance/the-prophets-of-babylon-nfts-4dea318dc729).

* 🏛️ Raise money for the treasury. We have raised **+700ETH for Babylon’s treasury, or \~$3.1M in exchange for \~1.4% of the network.**
* 💰 **Provide Liquidity for BABL**. The treasury has secured enough capital to bootstrap liquidity for BABL, the governance token behind Babylon. Our friends at 🚜 Harvest have already submitted a proposal to create a **Uniswap V3 Pool + Harvest Vault**. You can see [more information here](https://docs.google.com/document/u/1/d/1d3ZCVrvekktGhbiPLMNzw_1n8-12iYerm5GI2XAN_MY/edit#).
* ⚔️ **Call to arms**. One of our goals was to spread the word of Babylon and onboard new people into the protocol. Since we announced the event, our Discord server has increased more than **60%, from 8k to 13k** and our email list increase **50% from 16k to 24k**. Our protocol TVL has also seen an influx of new users and deposits, and even with the recent market downturn, we have **grown from $11M to $15M in TVL**.
* ⛺ **Reward Early Settlers.** It’s really important for Babylon to reward the participants that have been with us since the beginning. Early settlers have been rewarded and were able to mint a prophet for free. Thank you for all your support🙏🏿

The arrival has been an energy-intensive and time-consuming process.

Thanks to you, [2,422 Prophets](https://babylon.finance/prophets/gallery), we have emerged on the other side with the funds needed to grow Babylon together.

## The Now <a href="#id-3ee3" id="id-3ee3"></a>

Here are the immediate steps that we are taking as a community:

* If you are a prophet holder, you have immediate access to the beta and can **start depositing into** [**Babylon Gardens**](https://babylon.finance/portfolio) 🌴 immediately. Remember that we are in the first and highest quarter of mining rewards, where 53k BABL are distributed. [Learn more](https://docs.babylon.finance/babl/mining)
* Starting tomorrow, **November 20th at 8 am PST**, all the prophet holders — that are not US residents — will be able to 🎒**claim their BABL tokens** by visiting the [Prophets site](https://www.babylon.finance/prophets). Remember to check our gallery before buying a prophet on Opensea or any other secondary market. Our gallery is the only page to check if the BABL loot has been claimed.
* From Wednesday 24th at 8 am PST, you will be able to **stake your prophet** into a garden 🌴 and **receive extra mining rewards**. You can only stake one prophet per garden.
* If the [BIP-4 proposal is approved](https://docs.google.com/document/d/1d3ZCVrvekktGhbiPLMNzw_1n8-12iYerm5GI2XAN_MY/edit), you can expect BABL to be listed on Uniswap by November 28th. The proposal will also create a BABL vault on 🚜 Harvest so LPs can stake their tokens and receive **additional BABL.**
* At the beginning of December, we’ll add functionality in our gardens so they can take LP positions on the BABL pool, stake the LP tokens and compound the rewards.

## 🗡️ Onward <a href="#id-4225" id="id-4225"></a>

**We are a small community but a strong one**. 50 engaged wise prophets that love Babylon are more powerful than 100,000 weak hands.

In order to reward 💪 strong Babylonians, we’ll award **2 extra BABL** to every user that stakes a prophet in a garden before December 7th and keeps the prophet staked until our planned public launch (expected for mid January 2022).

**Remember why we are here**. We are here to remove intermediaries, increase financial access and give everyone a chance to build wealth and share it with others.

> The world will know that free men stood against a tyrant, that few stood against many…

![](https://miro.medium.com/max/1400/0*MsxeScMdNKhavPh8.jpg)


# The Prophets Arrival (Concluded)

The prophets are coming to Babylon on Nov 15th 2021

{% embed url="<https://medium.com/babylon-finance/the-prophets-of-babylon-nfts-4dea318dc729>" %}
Original Announcement on Medium
{% endembed %}

![The Arrival](/files/FMsttYLBKtd4MxjswyMj)

## 🔮 The Prophets are coming… <a href="#d2dc" id="d2dc"></a>

The Prophets are rare and crazy pieces of art in their own right, uniquely generated by combining 40+layers. The Prophets are coming to Babylon in **November** (**15th-19th**), in preparation for the protocol’s public release.

The Prophets are a limited collection of **10,000 unique, randomly generated NFTs**. The arrival event will enable the protocol to:

* 🏛️ Raise money for the treasury. **100% of the proceeds will go to the treasury**. The team will donate The Prophets to the treasury before the event. Token holders decide how the treasury capital can be effectively deployed to ensure the long-term sustainability of the protocol and BABL. The amount of value of the treasury also serves as a foundation to value the governance token.
* 💰 **Provide Liquidity for BABL**. After the arrival of The Prophets, the treasury will have enough capital to potentially bootstrap a liquidity pool on Uniswap/Sushiswap if the holders propose and approve it.
* ⛺ **Reward early settlers**. The users that have deposited in Babylon before October 16th will be able to mint a unique Prophet each for free.
* 📰 **Reach a wider audience**. The Prophets will spread [Arkad’s teachings](https://en.wikipedia.org/wiki/The_Richest_Man_in_Babylon) of Babylon around the web and social media landscape ahead of the public launch.

## NFTs + DeFi <a href="#id-7da9" id="id-7da9"></a>

Unlike other NFT projects with only roadmaps and promises, Babylon is a DeFi protocol that is already live. Babylon grew 400% last month in terms of TVL, reaching $9M. These Prophets provide **tangible benefits** in the protocol right away.

The **Prophets come bearing gifts** 🎁 that provide actual utility within the Babylon ecosystem.

First of all, they come with **70,000 BABL tokens split across the 10k NFTs**. Each prophet provides the owner the right to claim a valuable piece of Babylon through different amounts of BABL governance tokens. (Note: Claiming BABL is not available for people located in the US).

Secondly, they provide i**mmediate access to the private beta** 🎟️. The prophets will grant you one month of exclusive access along with the other beta users to the highest quarter of mining rewards (\~53K BABL). [The BABL mining program](https://medium.com/p/52c8dbf31065/edit) lasts for 10 years and the rewards curve slowly decreases, the Prophet ensures that you get at least two months of the first quarter, which is the highest in emissions.

In addition, some of the prophets come with **unique attributes that provide you with boosts and benefits** when participating in Babylon. Prophets can be staked into gardens and this will grant the owner rewards as a garden creator, strategist, voter, or LP. These attributes will be coded on-chain to foster composability similar to [Loot items](https://www.lootproject.com/).

Finally, the Prophets can be used as your **Babylon citizen ID**. You can use it as a way to prove your membership and also as your digital avatar within Babylon or anywhere else.

## 🖼️ Prophets <a href="#c02c" id="c02c"></a>

There are two kinds of Prophets. They all come with the gift of BABL. After their arrival, these prophets will leave Babylon and spread the teachings to every corner of the world.

![](https://miro.medium.com/max/1000/1*s_KdLM_rQ_VVdkhS9Pi0JQ.gif)

**Prophets** 🔮

* Supply: Elastic up to 8,000.
* Price: Fixed at 0.25 ETH. The first 300 will be claimable for free by early beta users.
* BABL Loot: Fixed at 5 BABL per Prophet. (40k total)
* Bonus: 1% LP Bonus.

**Great Prophets** 👑

* Supply: 1,000.
* Price: Auction-based. Starting prices range from 0.35 ETH — 50 ETH.
* BABL Loot: 7–1000 BABL each (30k total)
* Bonuses: 1–5% LP Bonus, 0–3% Voter Bonus, 0–3%, Strategist Bonus and 0–3% Creator Bonus.

**Note**: 1,000 legendary prophets will be reserved for future use by the protocol. The treasury, through governance, will have the ability to award them over the next years to contributors through different community-led initiatives.

## Arrival Mechanics <a href="#bfca" id="bfca"></a>

Babylon is not isolated. **Babylon exists within the Ethereum ecosystem**. Babylon is just one of many protocols, and as such, we believe being a good citizen means preventing gas wars and server congestion on the network. Vitalik has a[ good post explaining the problems with NFT events](https://vitalik.ca/general/2021/08/22/prices.html).

We are using a “Dual Prophet” system to achieve a balance between a fair and wide distribution and clearing at or close to near-market prices.

*Prophets* 🔮

In order to ensure a **fair price and a wide distribution**, we are limiting the number of prophets a person can buy to just one.

To **prevent gas wars and network congestion** towards the end of the event, we will give access to these Prophets in batches. Only users that have been whitelisted and proved they are humans can participate.

Successful entries will be sorted based on the timestamp of the verification. Upon verification, users will be able to tweet about the event to bump their position on the list. Existing Babylon beta users will have priority access.

*Great Prophets* 👑

In order to **maximize price discovery**, the great prophets will be auction-based. They don’t have a per-person limit.

To avoid **gas wars**, the great prophets sale will use an off-chain auction. Signatures will be used to represent and store the user bids.

We’ll use a [Vickrey auction](http://timroughgarden.org/f13/l/l2.pdf). A second-price or Vickrey auction is a **sealed-bid auction** in which the highest bidder wins and pays a price equal to the second-highest bid. You only pay enough to beat the second person, which provides strong performance guarantees and promotes people to truthfully bid their value.

In simpler terms:

* The 1,000 great prophets will be sorted by their floor price.
* Every person can submit **multiple bids**. You cannot see what amount other people bid.
* A bid needs to be above the floor price of a great prophet to qualify for it.
* A specific bid qualifies you for all the great prophets whose floor price is below your bid.
* Once the event ends, all bids will be disclosed. The **top 1,000 bids will receive the 1,000 great prophets**\*

\***Note**: In reality, things are a bit more complicated. After sorting the bids, it is possible although not likely that there are no bids above the floor price of some great prophets, leaving them unclaimed.


# Great Prophets Auction

The 1,000 Great Prophets are coming to Babylon...

## When

From: Monday, Nov 15th 2021 at 8:00 am PST.

To: Friday, Nov 19th 2021 at 4:00pm PST.

## Auction Summary

The 1,000 great prophets are auctioned. The Great Prophets are sorted by their value. The auction will collect bits until the auction ends.  **The top 1,000 bids will receive the great prophets**.

* In order to **maximize price discovery**, the great prophets will be auction-based. They don’t have a per-person limit.
* To avoid **gas wars**, the great prophets sale will use an off-chain auction. Signatures will be used to represent and store the user bids.

We’ll use a [Vickrey auction](http://timroughgarden.org/f13/l/l2.pdf). A second-price or Vickrey auction is a **sealed-bid auction** in which the highest bidder wins and pays a price equal to the second-highest bid.&#x20;

You only pay enough to beat the second person, which provides strong performance guarantees and promotes people to truthfully bid their value.

In simpler terms:

* The 1,000 great prophets will be sorted by their floor price.
* You cannot see other people's bids until the auction has ended.
* Every person can submit **multiple bids**. You cannot see what amount other people bid.
* A bid needs to be above the floor price of a great prophet to qualify for it.
* A specific bid qualifies you for all the great prophets whose floor price is below your bid.
* Once the event ends, all bids will be disclosed. The **top 1,000 bids will receive the 1,000 great prophets**\*

## Auction FAQ

### What asset do I need to place a bid on the auction?

You need to have WETH in your wallet.

### How many bids can I submit?

You can place as many bids as you want. We recommend distributing bids across different price ranges.

### Where can I see all the great prophets?

Head to the [gallery](https://www.babylon.finance/prophets/gallery?page=334).

### What happens if there is a tie?

The one submitted first wins.

### Can I bid just for a specific prophet?

No. Your bid will qualify you for all the prophets below your bid amount. Great prophets will be sorted and given in order to the top 1,000 bids.

### Do I need to pay for gas?

You only need to approve WETH from your wallet once.&#x20;

Bidding is done through off-chain signatures and it's free.

### Does the bid include the minting cost?

Yes, once the auction ends, winning bids will receive the minted great prophets in their wallet.

### How do I know that the bids are legit?

You can see the live feed of bids [here](https://babylon.finance/prophets/bids). While the auction is live, the amounts will be hidden. Once the auction ends, you will be able to see the bid amounts and who wins which prophet.&#x20;

### What's the minimum amount I can bid?

0.4 WETH.&#x20;

It's the floor price of the cheapest great prophet [Assoros](https://babylon.finance/prophets/gallery/8001).

### What's the maximum amount I can bid?

200 WETH

### What happens if I am the only bid that qualifies for a prophet?

You will win the bid and you will only need to pay the floor price of the prophet.

### What happens if I a great prophet doesn't have any bids?

The treasury will keep ownership of the great prophet and may decide to put it again for sale later.

### When can I claim the BABL loot?

As soon as the auction ends, there will be a claim page available where you can claim your tokens.


# Security

This page summarizes our Security documentation, Audits, Processes and Security Management Plan, which is our plan for reducing risks and preventing and responding to incidents.

## Security Repository

Our security Github repository is now publicly available (<https://github.com/babylon-finance/security>)&#x20;

It includes our [**Security Audits**](https://github.com/babylon-finance/security/blob/main/audits/README.md), our [**Security Contact PGP keys**](https://github.com/babylon-finance/security/blob/main/SECURITY.md#receiving-disclosures)**, our** [**Public Disclosures**](https://github.com/babylon-finance/security/tree/main/disclosures) information (if any) and it will also include our [**Bug Bounty Program**](https://github.com/babylon-finance/security/blob/main/SECURITY.md#bug-bounty-program)

{% embed url="<https://github.com/babylon-finance/security>" %}

{% embed url="<https://immunefi.com/bounty/babylonfinance>" %}

## Security Master Plan

Security is an essential component of the protocol. It's an ongoing process, not an add-on or review that happens once and is complete. We follow a security-by-design process that includes **continuous** actions at the infrastructure and SDLC (Software Development Life Cycle) level. This continuous process is part of our Security Management Plan which is our plan for reducing risks and preventing and responding to incidents.

## Methodology

The following agile methodology has been defined for Babylon in order to identify, address and protect the protocol from the most dangerous risks:

| Step   | Process                                                                                                                                                                        |
| ------ | ------------------------------------------------------------------------------------------------------------------------------------------------------------------------------ |
| Step 0 | **Methodology:** Define the agile methodology influenced by ISO27K standards to run Risk Assessment, Risk Management, and set-up an Incident Response Plan.                    |
| Step 1 | **Threat modeling:** Threat modeling and risk identification through in-depth research about prior DeFi security incidents.                                                    |
| Step 2 | **Technical security analysis:** Identify security issues and bugs by running continuous security audits by internal and/or external staff/companies.                          |
| Step 3 | **Risk Assessment and Countermeasures:** Identify main risks as well as their ideal countermeasures and remediations based on the state of play.                               |
| Step 4 | **Projects and initiatives and their prioritization:** Define the Security Risk Management projects, their prioritization and suggest some proposals to improve (Deming Cycle) |
| Step 5 | **Approval:** Get Approval                                                                                                                                                     |
| Step 6 | **Launch the Security Master Plan**                                                                                                                                            |
| Step 7 | **Launch the Incident Response Plan**                                                                                                                                          |

## Threat Modeling summary

As part of the risk assessment and management process we present below some of the most relevant security risks identified during this step. As part of the security-by-design methodology our team has identified and implemented several countermeasures either to reduce their impact and/or the probability of occurrence.

![](/files/-MdJ8R55HbRFmgHycnD3)

## Technical Security Analysis summary

The **scope** of our technical security analysis includes but it is not limited to the protocol, dApp as well as the required infrastructure:

![](/files/-MdJ90qbbw28PC2aMWOz)

#### Internal (continuous) security audit

Most organizations run a technical security analysis at certain moments. However, we think it's important to have a **continuous security analysis process.** Any new change, fix or pull request is audited using a security-by-design pattern. The audit is run by a different team member and there should be a minimum of two different team members auditing the code pushed by a third team member.

![](/files/-MdJ9AgPVv4TB3Pb8U51)

As shown in the picture, issues are categorized depending on their severity.

The continuous process helps us to identify problems and fix them quickly while we document the pull request that solves the issue. The fix usually includes the exploit to reproduce, validates the issue is exploitable, and include the patch that disables the exploit.

#### External security audits

We work with external security audit partners to review our code at different snapshots in time. These companies work closely with our internal security audit team.

We plan to work with **3 different security companies** for three complete audits (each audit has one to two rounds).

The first security company has already finished its audit (two rounds) and did not find any critical issues. The audit report and company details will be published together with reports from the other two companies once we launch publicly.

## Security Risk Management and Projects Prioritization

After a security analysis, we implemented several countermeasures, each of which are in a different stage today. This process is considered one of the most important parts of Risk Management. Security Projects are defined by different topics, each with different actions and countermeasures as shown in the following image:

![](/files/-MdJBa2j-VqSTArUh5rL)

Just as an example, some of the most relevant countermeasures are:

* **Internal (continuous) security audit (ISA) process**
* **External security audits by different security audit firms**
* **Pause guardian**
* **Reentrancy guard**
* **Flashloans hard lock**
* **Key management policy (2FA, Multisig, etc.)**
* **Security test coverage**
* **Pair programming**
* **Security event management** (monitoring and detection)
* **Cyber exercises**
* **Incident response plan**
* **Vulnerability management**
* **Bug bounty planned**
* **Need to know policy**
* **Awareness raising**

Following the standards like ISO27K and best practices, we are also identifying new proposals to implement in the future (Deming cycle).

## Incident response summary

Nearly every organization experiences cyber attacks, and unfortunately Babylon will not be an exception. This is why we have an incident response plan that will allow us to more rapidly respond and contain an incident if/when one occurs.&#x20;

As part of the incident response plan we identify different phases, each of them with different sub-processes:

![](/files/-MdJCX9FzPUKtONZrZYN)

We know that **100% security does not exist** so we need to be prepared for recovery. That is why we work on containment and recovery measures that might help Babylon and its users in the event of an incident.

#### Monitoring and detection

We have implemented different mechanisms to provide monitoring and detection capabilities. Some of them are well-known like **OpenZeppelin Defender** and **Tenderly**. We also work with **business partners** that are helping Babylon to improve its alerting system channels.

![](/files/-MdJCz0BsS7PpG5QN1eC)

![](/files/-MdJD1PqcTXGmxORbzAe)

#### *Support channel*

*The protocol is in alpha testing so we have opened a support channel for our users which might help in the detection of hidden issues or bugs. Any new issue is validated, categorized and prioritized to better support our users.*

Note: all **security incidents and vulnerabilities** must be reported using an **encrypted email** as described below in the next section.

#### Security Incidents and Vulnerability Management Program

Our Vulnerability Management Program has two parts:

* **Bug bounty program (starting soon)**
* **Vulnerability / Security Incident report intake channel (please use encrypted communications using our public** [**PGP/encrypted communication channel**](https://keys.openpgp.org/vks/v1/by-fingerprint/5495D6527E623F06B32FDDDA876AAFCF0323BF77)**)**

At Babylon Finance we are committed to working with researchers who submit security vulnerability notifications to us. We will resolve issues on an appropriate timeline and perform a coordinated release, giving credit to the reporter if they would like.

Please submit **all security issues** **by email** to **the following point of contact** and please give as much details as you can in order we can reproduce and validate the security issue, vulnerability or incident:

| **Contact**  | **Public key**                                                                                 | **Email**                       | **Key ID**    |
| ------------ | ---------------------------------------------------------------------------------------------- | ------------------------------- | ------------- |
| **Security** | [PGP](https://keys.openpgp.org/vks/v1/by-fingerprint/5495D6527E623F06B32FDDDA876AAFCF0323BF77) | **security at babylon.finance** | **0323 BF77** |
| **Raúl**     | [PGP](https://keys.openpgp.org/vks/v1/by-fingerprint/D3A79AD075F1ABDA54C05380F3BB8736610687C1) | **raul at babylon.finance**     | **6106 87C1** |

#### DeFi Cyber Threat Intelligence and best practices

We believe that DeFi security will improve if we foster collaboration between the different DeFi protocols. If you're interested in sharing best practices or working together, please feel free to reach out to the email above.

### References:

* OpenZeppelin Defender entries from \[Advisor]\(<https://defender.openzeppelin.com/#/advisor/doclist?)>.
* Magoo graveyard at [Github](https://magoo.github.io/Blockchain-Graveyard/).
* Thesis paper from [MIT research](http://web.mit.edu/smadnick/www/wp/2019-05.pdf).
* Yearn finance security process: <https://github.com/yearn/yearn-security>, <https://github.com/yearn/yearn-security/blob/master/SECURITY.md>
* FIRST: <https://www.first.org/standards/frameworks/csirts/csirt_services_framework_v2.1>
* NIST: <https://nvlpubs.nist.gov/nistpubs/SpecialPublications/NIST.SP.800-61r2.pdf>
* SEI (Carnegie Mellon): <https://resources.sei.cmu.edu/library/asset-view.cfm?assetID=6305>
* Reference Security Incident Taxonomy Working Group. Reference Security Incident Classification Taxonomy: <https://github.com/enisaeu/Reference-Security-Incident-Taxonomy-Task-Force/blob/master/working_copy/humanv1.md>
* Security policies (spanish)(INCIBE): <https://www.incibe.es/protege-tu-empresa/herramientas/politicas>
* Cyber-incident management procedure (INCIBE): <https://www.incibe-cert.es/sites/default/files/contenidos/guias/doc/incibe-cert_cyber_incident_management_private_sector.pdf>
* Agile online Risk Assessment tool (spanish)(INCIBE): <https://adl.incibe.es/#>
* MIT: Systematic Approach to Analyzing Security and Vulnerabilities of Blockchain Systems: <http://web.mit.edu/smadnick/www/wp/2019-05.pdf>
* ISO 27001: <https://www.iso.org/isoiec-27001-information-security.html>
* ISO 31000: <https://www.iso.org/iso-31000-risk-management.html>
* ISO 22301: <https://www.iso.org/standard/75106.html>
* SecurityMetrics <https://www.securitymetrics.com/lp/pci/how-to-make-and-implement-a-successful-incident-response-plan>
* Traffic Light Protocol (TLP): <https://www.first.org/tlp/>


# Risks

This page includes a non-exhaustive list of risks you incur by depositing funds into a Babylon Garden.

#### **Integration Risk**

Babylon integrates with several DeFi protocols (Aave, Kyber, Yearn, etc.) to offer a wide range of investment opportunities. However,  this makes us vulnerable to risks in the underlying protocols.&#x20;

For example, an integration may lose capital due to a digital breach; although we have designed the protocol to compartmentalize these risks, making them very unlikely, they may occur and could have detrimental effects. These risks carry varied outcomes of severity and impact.

**Ethereum Risk**

Babylon is built on top of Ethereum and as such, is vulnerable to bugs or hacks in the Ethereum Virtual Machine or EVM. This is an extremely unlikely event, which would also collapse the value in the whole ecosystem but it can happen.

**User Hacks**

Our users and customers may be hacked via malicious digital exploits. If the user's OS or browser is compromised, this could generate a loss of funds or, at the very least, negatively impact our application.

**Product Risk**

Our frontend could have bugs and/or digital breaches that may result in miscalculations, loss of user's funds, and/or prevent users from accessing the protocol. Withdrawals and deposits may be halted as these issues could effect the viability of the platform.

**Yield Risk**

Right now, risk-free interest rates in DeFi are really high. We expect these numbers to trend lower in the following years although we expect them to remain considerably higher than the rates available in traditional finance. If the numbers become commoditized quickly and the transaction costs increase, many investment opportunities in DeFi wouldn't be as profitable. This can effect the long-term viability of the platform.

**Malicious Garden Takeovers**

Gardens may be controlled by large capital manipulation. Although these kinds of attacks are highly disincentivized by our mechanism and design, individuals willing to pay a high price could take over a Garden and activate investment Strategies that could result in the loss of a user's capital investment. Similar to a 51% attack in Bitcoin, engaging in this type of exploit is a negative-sum game where both the attacker and the members of the community would lose capital.

**Smart Contract Risks**

Although we do our best to employ the best security practices, there is always a risk that Babylon suffers a digital breach that could compromise user capital. It is also possible for an attacker to compromise the Babylon governance system and change protocol parameters or upgrade the main controller with the goal of accessing capital from our users.


