# FreeDona Protocol

## Backgrounds

In the development of the Ethereum ecosystem, many teams are facing the dilemma of fund shortages. In order to alleviate this situation, FreeDona, as a decentralized non-custodial protocol which is under the strong support of the Ethereum Foundation, can help users donate the yields generated by their deposits in DeFi projects to the teams that lack funds.


# What is FreeDona

After users deposits the principal to FreeDona protocol, FreeDona will act as a fund manager to deposit the user's principal in batches into mainstream DeFi projects (such as Compound, Aave, etc.) to generate yields.‌

These revenues will continue to accumulate over time and become the source of the fund for donations. To boost the Ethereum developer ecosystem, FreeDona will withdraw and donate the yields to the designated Ethereum project in accordance with the EF or the results of community voting in future.

![Figure 1](https://gblobscdn.gitbook.com/assets%2Ffreedona-1%2F-MbKwvdOOHD6wTnrN3eZ%2F-MbKyXjRWemjIjq-ElQH%2F0.png?alt=media)


# Architecture

FreeDona consists of five parts.‌

**1.Proxy Contract**&#x20;

It is a proxy contract that transfers user calls to the logical contract for execution.

**2.Logic Contract**&#x20;

Responsible for logic execution, mainly including user deposit, user withdraw, and donation interest, etc, and it is convenient for users to query.

**3.Storage Contract**

Record the user's funds, the amount of shares, and the total funds, total shares, and interest shares of the entire pool.

**4.Risk Management Contract**

Mainly responsible for fund safety management and asset management configuration. The risk control is to protect users’interests from loss.

**5.DAO Governance Contract**

It is expected to be activated in Stage 2 (See roadmap for more).

The relationships between each contract are described in Figure 2 below.

![Figure 2](https://gblobscdn.gitbook.com/assets%2Ffreedona-1%2F-MbKwvdOOHD6wTnrN3eZ%2F-MbKyXjSGywoHAA0d7WG%2F1.png?alt=media)


# Ledger structure

| Category       | Detail              | Description                                                                                                                                |
| -------------- | ------------------- | ------------------------------------------------------------------------------------------------------------------------------------------ |
| User ledger    | User address        | The address used by the user when transferring funds to FreeDona.                                                                          |
|                | Deposit amount      | The amount of funds deposited by the user.                                                                                                 |
|                | Deposit share       | The amount of share corresponding to the user's deposited funds.                                                                           |
|                | Donation ratio      | The proportion of the user's yields used for donations.                                                                                    |
| General ledger | Liquidity           | Available funds in FreeDona which can be easily redeemed by users.                                                                         |
|                | Total deposit share | The total amount of share corresponding to all users' deposited funds.                                                                     |
|                | Donation share      | the total amount of share corresponding to the yields used for donations, which is used to help the development of the Ethereum ecosystem. |


# Main functions

The purpose of our protocol is to provide the following functions: user deposit, user withdrawing fund interaction with DeFi protocol, funds trigger, donation.

At the same time, FreeDona also provides users with the access to the information of both users and the general ledger.

**1. User deposit**

The user deposits funds in FreeDona and obtains the corresponding share of the certificate token. The FreeDona storage contract records user address, deposit amount, and the change of user's deposit share, liquidity of protocol, and the total deposit share.

When Liquidity is over threshold value, the FreeDona logic contract automatically deposits the funds into DeFi protocols to generate yields.

![Figure 3](https://3807644760-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Ffreedona-1%2F-MbKwvdOOHD6wTnrN3eZ%2F-MbKyXjTAf8JymuZ8nlp%2F2.png?generation=1622792613928775\&alt=media)

&#x20;**2. User withdraw**

The user can use the User Address and the Deposit Share he holds to redeem the principal deposited to FreeDona before. FreeDona will return the corresponding funds to the User Address. The corresponding part of the yields will be donated to build the Ethereum ecosystem.

When Liquidity is more than the amount of funds that the user wants to redeem, FreeDona will returns the principal to the user's address directly.

When Liquidity is less than the amount of funds that the user wants to redeem, FreeDona's logic contract will retrieves the deposit amount from the DeFi protocols and returns the principal to the user's address automatically.

![Figure 4](https://3807644760-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Ffreedona-1%2F-MbKwvdOOHD6wTnrN3eZ%2F-MbKyXjUiyQqWe_bUp3d%2F3.png?generation=1622792613910547\&alt=media)

**3. Deposit in DeFi**

When Liquidity is over threshold value, the FreeDona logic contract automatically deposits the funds into DeFi protocols to generate yields.

**4. Withdraw from DeFi**

When Liquidity is less than threshold value, FreeDona will withdraw the funds from DeFi protocols.

**5. Funds trigger**

In order to save gas, we adopt a combination of various triggering methods.

* Quantitative trigger: When the Liquidity reaches the threshold, it is triggered quantitatively (by user deposit or user withdraw). FreeDona will automatically deposits or withdraw Liquidity in DeFi protocols as shown in Figure 5.
* Active trigger: when admin address (fund management) or user call the contract proactively, FreeDona will automatically deposits or withdraw Liquidity in DeFi protocols.

![Figure 5](https://3807644760-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2Ffreedona-1%2F-MbKwvdOOHD6wTnrN3eZ%2F-MbKyXjVNEfDvL-1wJXs%2F4.png?generation=1622792613847338\&alt=media)

**6. Donate**

When admin address (donation) calls the yield donation interface, FreeDona will take out the corresponding accumulated yields and donate it to Ethereum projects to provide help.

In the third stage, FreeDona will vote among the community through the DAO governance contract to determine which project will be funded.

**7. User deposit query**

Used to query the information of the user's deposit funds.

**8. User available donation query**

Used to query information about the yields that users can use for donations.

**9. General funds query**

Used to query the information of total funds in FreeDona.

**10. General available donation query**

Used to query information about the yields that can be used for donations in FreeDona


# Fund controller

As shown in the figure below, in order to ensure the safety of users' funds, we have carried out corresponding risk control designs including authority management, fund transfer control, and access of supporting assets.

![](https://gblobscdn.gitbook.com/assets%2Ffreedona-1%2F-MbKwvdOOHD6wTnrN3eZ%2F-MbKyXjWVBRtyUrPxhDo%2F5.png?alt=media)

&#x20;                                                                                    Figure 6


# Authority management

In terms of fund authority management, we have designed switches in each involved fund flows. Even in an emergency, the emergency measures can be taken to shut down various switches through risk management contract to prevent fund losses.

**1. User deposit switch**

When closed, user deposit is suspended.

**2. User withdraw switch**

When closed, user withdrawal is suspended.

**3. Deposit in DeFi switch**

When closed, depositing to DeFi projects is suspended.

**4. Withdraw from DeFi switch**

When closed, the withdrawal of DeFi projects is suspended.

**5. Donation switch**

When closed, the accumulated yields cannot be donated.


# Fund transfer control

In terms of fund transfer control, we can adjust the various quotas, deposit ratios, and donation ratios in Liquidity in the risk management contract to ensure the stable operation of the entire system.

**1. Minimum deposit period**

The minimum allowable period from the user's deposit to withdrawal. If the use's deposit period is shorter than this, the withdrawal will be rejected.

**2. Minimum amount of Liquidity**

The minimum liquidity set for users to deposit and withdraw funds

**3. Maximum amount of Liquidity**

The maximum amount of liquidity is set on the basis of facilitating user interaction. Funds exceeding this limit will be deposited into DeFi projects.

**4. Minimum amount of deposit to DeFi**

In order to enhance the efficiency of gas usage, it is necessary to ensure that the fund deposited in DeFi is more than this minimum amount each time.

**5. Liquidity ratio**

In order to ensure a certain income, it is necessary to maintain a certain ratio of Liquidity and total principal.


# Access to supported assets

In terms of access of supporting assets, we can add or delete supported DeFi projects and asset types through risk management contracts.

**1. Add/Delete asset types**

In the corresponding DeFi protocol, add or delete supported asset types and set the corresponding allocation ratio, based on risk control evaluation or community voting results.

**2. Support new DeFi protocol**

Support for the newly admitted DeFi protocols, based on risk control evaluation or community voting results.


# Yield distribution

In FreeDona, the principal deposited by the user will be invested in DeFi protocols to accumulate yields. In DeFi lending projects, our income usually consists of two parts. For example, if we deposit ETH to the Compound protocol, we can get some ETH (Original token) as lending interests and some COMP (DeFi token) tokens distributed by Compound. In FreeDona, the two types of yields will be distributed differently.

#### The distribution method of the original token

As shown in the figure 8, the original token yields will be distributed in 3 ways and will be realized in different stages.

![Figure 8](https://3807644760-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbKwpRHgQrmakhmsWz5%2F-MbecmAkBZQJrN5Da8Y2%2F-Mbecxh1ya_lqChDFlXo%2Fimage.png?alt=media\&token=71b639de-4685-4e73-a662-1bf178e83191)

**1. for User**

This part of the yields is distributed to users. The user can adjust the proportion used for self-retention, and the upper limit is 50%. When the user withdraws, he will receive the corresponding part of the yields along with the principal.

**2. for Donation**

After deducting the user's own yields and the project maintenance cost, the rest of total cumulative yields will be used for community donations.

**3. for Operation**

For the sustainable operation of this public good project, such as protocol interaction, upgrades, etc., 5% of the total cumulative yields is reserved for maintenance. This ratio supports adjustments based on project operations.

#### The distribution method of the DeFi token

As shown in the figure 9, DeFi token yields will be used for community donation and project maintenance, not for distribution to users. The distribution of DeFi token yields will be realized in the first stage.

![Figure 8](https://3807644760-files.gitbook.io/~/files/v0/b/gitbook-legacy-files/o/assets%2F-MbKwpRHgQrmakhmsWz5%2F-MbobHUqA7rj3s7NTbeG%2F-MbobtKSh75Ihi0yKGRV%2Fimage.png?alt=media\&token=0d85cb0e-72d7-4be7-b405-65f8eccb1d14)

**1. for Donation**

After deducting the project maintenance cost, the left of total cumulative yields will be used for community donations.

**2. for Operation**

As mentioned before, 5% of the total cumulative yields is reserved for project operation. This ratio supports adjustments based on project operations.


# Funds security

Security is the top priority of the FreeDona protocol. We have adopted an internal and external combined method to ensure the safety of users’ funds.

**1. Security of funds flow**

The funds deposited by users into FreeDona will be automatically managed in strict accordance with the process and will not be transferred to private addresses at will.

The user's funds will only be transferred between the user's address, FreeDona contract, and DeFi protocols. The accumulated interest will be used for distribution to users, donations, and project operations, and will not enter other unrelated addresses.

**2. Emergency plan**

Once FreeDona is exposed to a serious problem, we will suspend the corresponding service through the risk management contract to prevent the user's funds from being damaged, and follow up to solve the problem in time.

**3. Security specifications**

FreeDona is developed in compliance with safety principles and specifications, and has been formally verified by Mythril (static and dynamic safety analysis), using the SafeMath library to prevent digital overflow.


# Codes security

**1. Third-party audit**

Our development team plans to work with third-party auditors and consultants to create the protocol that we believe are secure and reliable.

**2. Bug bounty program**

Security researchers are eligible to receive bounty for reporting undiscovered vulnerabilities.

**3. Bug bounty program**

All contract codes and balances can be publicly verified.


# Test plan

We will go through 3 steps before the official launch.

1. Complete the technical document design, which is currently in progress.
2. Complete the development, deploy to the rinkeby test network, and perform functional testing. It is expected to take one month or so.
3. Conduct code review and release the public network test version. After the test is passed, it will be officially released. The time is tentatively scheduled for one month or so.


