Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

docs: edit farming spec SEE INSTEAD https://github.com/tendermint/farming/pull/191 #188

Closed
wants to merge 12 commits into from
38 changes: 26 additions & 12 deletions x/farming/spec/01_concepts.md
Original file line number Diff line number Diff line change
@@ -1,35 +1,49 @@
<!-- order: 1 -->

# Concepts

## Farming Module

`x/farming` is a Cosmos SDK module that implements farming functionality that keeps track of the staking and provides farming rewards to farmers. A primary use case is to use this module to provide incentives for liquidity pool investors for their pool participation.
The `x/farming` Cosmos SDK module implements farming functionality that keeps track of staking and provides farming rewards to farmers. A primary use case of this module is to provide incentives for liquidity pool investors for their pool participation.

## Plans

There are two types of farming plans in the `farming` module as below.
There are two types of farming plans in the `farming` module:

### Public Farming Plan
barriebyron marked this conversation as resolved.
Show resolved Hide resolved

### 1. Public Farming Plan
A public farming plan can be created only through governance proposal. The proposal must be first agreed and passed before a public farming plan can be created.
barriebyron marked this conversation as resolved.
Show resolved Hide resolved

A public farming plan can only be created through governance proposal meaning that the proposal must be first agreed and passed in order to create a public plan.
### 2. Private Farming Plan
### Private Farming Plan

A private farming plan can be created with any account. The plan creator's account is used as `TerminationAddress`. There is a fee `PlanCreationFee` paid upon plan creation to prevent from spamming attack.
A private farming plan can be created with any account.

- The account address of the plan creator account is used as the `TerminationAddress`.
- To prevent from spamming attacks, the `PlanCreationFee` fee must be paid on plan creation.

## Distribution Methods

There are two types of distribution methods in the `farming` module as below.
### 1. Fixed Amount Plan
There are two types of reward distribution methods in the `farming` module:

### Fixed Amount Plan

A `FixedAmountPlan` distributes fixed amount of coins to farmers for every epoch day. If the plan creators `FarmingPoolAddress` is depleted with distributing coins, then there is no more coins to distribute unless it is filled up again.
A `FixedAmountPlan` distributes a fixed amount of coins to farmers for every epoch day.

### 2. Ratio Plan
When the plan creator's `FarmingPoolAddress` is depleted, then there are no more coins to distribute until more coins are added to the account.

A `RatioPlan` distributes to farmers by ratio distribution for every epoch day. If the plan creators `FarmingPoolAddress` is depleted with distributing coins, then there is no more coins to distribute unless it is filled up with more coins.
### Ratio Plan

A `RatioPlan` distributes coins to farmers by ratio distribution for every epoch day.

If the plan creator's `FarmingPoolAddress` is depleted, then there are no more coins to distribute until more coins are added to the account.
barriebyron marked this conversation as resolved.
Show resolved Hide resolved

## Accumulated Reward Calculation

In farming module, farming rewards are calculated per epoch based on plans. The rewards for a single farmer can be calculated by taking the total rewards for the epoch before the staking started, minus the current total rewards. The farming module takes references from [F1 Fee Distribution](https://github.com/cosmos/cosmos-sdk/blob/master/docs/spec/fee_distribution/f1_fee_distr.pdf) that is used in Cosmos SDK [x/distribution](https://github.com/cosmos/cosmos-sdk/blob/master/x/distribution/spec/01_concepts.md) module.
In the farming module, farming rewards are calculated per epoch based on the distribution plan.

To calculate the rewards for a single farmer, take the total rewards for the epoch before the staking started, minus the current total rewards.

The farming module takes references from [F1 Fee Distribution](https://github.com/cosmos/cosmos-sdk/blob/master/docs/spec/fee_distribution/f1_fee_distr.pdf) that is used in the Cosmos SDK [x/distribution](https://github.com/cosmos/cosmos-sdk/blob/master/x/distribution/spec/01_concepts.md) module.

### Accumulated Unit Reward

Expand Down
4 changes: 3 additions & 1 deletion x/farming/spec/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,9 @@

## Abstract

This document specifies the farming module of the Cosmos SDK that serves farming feature
This document specifies the farming module of the Cosmos SDK that serves farming feature. The farming module implements farming functionality that provides farming rewards to participants called farmers.

A primary use case of the farming module is to provide incentives for liquidity pool investors for their pool participation.

## Contents

Expand Down